diff options
Diffstat (limited to 'llvm/lib/System')
-rw-r--r-- | llvm/lib/System/Unix/Path.inc | 10 | ||||
-rw-r--r-- | llvm/lib/System/Win32/Path.inc | 9 |
2 files changed, 19 insertions, 0 deletions
diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc index 9e90dda04e0..025357258dc 100644 --- a/llvm/lib/System/Unix/Path.inc +++ b/llvm/lib/System/Unix/Path.inc @@ -250,6 +250,16 @@ Path::GetUserHomeDirectory() { return GetRootDirectory(); } +Path +Path::GetCurrentDirectory() { + char pathname[MAXPATHLEN]; + if (!getcwd(pathname,MAXPATHLEN)) { + assert (false && "Could not query current working directory."); + return Path(""); + } + + return Path(pathname); +} std::string Path::getBasename() const { diff --git a/llvm/lib/System/Win32/Path.inc b/llvm/lib/System/Win32/Path.inc index 2484b8a744e..7d965291613 100644 --- a/llvm/lib/System/Win32/Path.inc +++ b/llvm/lib/System/Win32/Path.inc @@ -222,6 +222,15 @@ Path::GetUserHomeDirectory() { } return GetRootDirectory(); } + +Path +Path::GetCurrentDirectory() { + char pathname[MAX_PATH]; + GetCurrentDirectory(pathname,MAX_PATH); + return Path(pathname); +} + + // FIXME: the above set of functions don't map to Windows very well. |