From 6ddf2c1930d896cbe738fab7d07dc977df41918e Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Thu, 9 Apr 2009 00:33:08 +0000 Subject: Add sys::Path::makeAbsolute(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68663 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/System/Path.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/System/Path.cpp') diff --git a/lib/System/Path.cpp b/lib/System/Path.cpp index c5a4b0676f..4c965db722 100644 --- a/lib/System/Path.cpp +++ b/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