diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-04-09 00:33:08 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-04-09 00:33:08 +0000 |
commit | 6ddf2c1930d896cbe738fab7d07dc977df41918e (patch) | |
tree | 905a40f9d96fa08d8cea66a2271db3c7e6dd7589 /lib/System/Path.cpp | |
parent | 2eb65e292cf7724d2f5f6773e2460b9420cee34c (diff) |
Add sys::Path::makeAbsolute().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68663 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Path.cpp')
-rw-r--r-- | lib/System/Path.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
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<Path>& Paths) { const char* at = path; const char* delim = strchr(at, PathSeparator); |