summaryrefslogtreecommitdiff
path: root/lib/System/Unix/Path.inc
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-12 20:23:56 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-12 20:23:56 +0000
commita00e85c9b1d57d3ba89592b95f55c571170a8ab9 (patch)
tree2308df5e2076e54bc4368f71c1267730a2770640 /lib/System/Unix/Path.inc
parentf36892335b4919b9120e48a792e6b3630b9de978 (diff)
downloadllvm-a00e85c9b1d57d3ba89592b95f55c571170a8ab9.tar.gz
llvm-a00e85c9b1d57d3ba89592b95f55c571170a8ab9.tar.bz2
llvm-a00e85c9b1d57d3ba89592b95f55c571170a8ab9.tar.xz
Improve sys::Path::makeAbsolute on Win32.
- Patch by Viktor Kutuzov! - Minor tweak by me to add llvm_unreachable calls on FIXMEd error paths. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75424 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix/Path.inc')
-rw-r--r--lib/System/Unix/Path.inc13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc
index 125a0ab209..e951fa0355 100644
--- a/lib/System/Unix/Path.inc
+++ b/lib/System/Unix/Path.inc
@@ -109,6 +109,19 @@ Path::isAbsolute() const {
return false;
return path[0] == '/';
}
+
+void Path::makeAbsolute() {
+ if (isAbsolute())
+ return;
+
+ Path CWD = Path::GetCurrentDirectory();
+ assert(CWD.isAbsolute() && "GetCurrentDirectory returned relative path!");
+
+ CWD.appendComponent(path);
+
+ path = CWD.toString();
+}
+
Path
Path::GetRootDirectory() {
Path result;