From df555fd6f8bcfa1744dd447fdefbf06dbd627a2c Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sun, 12 Jul 2009 20:23:56 +0000 Subject: 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 --- llvm/lib/System/Unix/Path.inc | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'llvm/lib/System/Unix') 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; -- cgit v1.2.3