diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-12 20:23:56 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-12 20:23:56 +0000 |
commit | df555fd6f8bcfa1744dd447fdefbf06dbd627a2c (patch) | |
tree | 62f24b3eddab31a8742b91f379306bdd7f54e666 /llvm/lib/System/Unix/Path.inc | |
parent | 08954aa4e1c9850f6cee629a297616bda62da4f9 (diff) | |
download | bcm5719-llvm-df555fd6f8bcfa1744dd447fdefbf06dbd627a2c.tar.gz bcm5719-llvm-df555fd6f8bcfa1744dd447fdefbf06dbd627a2c.zip |
Improve sys::Path::makeAbsolute on Win32.
- Patch by Viktor Kutuzov!
- Minor tweak by me to add llvm_unreachable calls on FIXMEd error paths.
llvm-svn: 75424
Diffstat (limited to 'llvm/lib/System/Unix/Path.inc')
-rw-r--r-- | llvm/lib/System/Unix/Path.inc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc index 125a0ab209c..e951fa03557 100644 --- a/llvm/lib/System/Unix/Path.inc +++ b/llvm/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; |