From 3f48987069db68bf39db1d4081ea2f5262a35dff Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 9 Apr 2009 00:33:08 +0000 Subject: Add sys::Path::makeAbsolute(). llvm-svn: 68663 --- llvm/lib/System/Path.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'llvm/lib') diff --git a/llvm/lib/System/Path.cpp b/llvm/lib/System/Path.cpp index c5a4b0676ff..4c965db7223 100644 --- a/llvm/lib/System/Path.cpp +++ b/llvm/lib/System/Path.cpp @@ -207,6 +207,18 @@ bool Path::hasMagicNumber(const std::string &Magic) const { return false; } +void Path::makeAbsolute() { + if (isAbsolute()) + return; + + Path CWD = Path::GetCurrentDirectory(); + assert(CWD.isAbsolute() && "GetCurrentDirectory returned relative path!"); + + CWD.appendComponent(path); + + path = CWD.toString(); +} + static void getPathList(const char*path, std::vector& Paths) { const char* at = path; const char* delim = strchr(at, PathSeparator); -- cgit v1.2.3