diff options
| author | Ted Kremenek <kremenek@apple.com> | 2007-12-18 22:07:33 +0000 |
|---|---|---|
| committer | Ted Kremenek <kremenek@apple.com> | 2007-12-18 22:07:33 +0000 |
| commit | 79200788df8d946eae6973709b998a7f3a4cb754 (patch) | |
| tree | 6644227d4f4f9db126b48d411570e4b40686cdda /lib/System/Unix | |
| parent | 280f4565eb599ce424c204b9ea07130d772af7e3 (diff) | |
Added "GetCurrentDirectory()" to sys::Path.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45182 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System/Unix')
| -rw-r--r-- | lib/System/Unix/Path.inc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc index 9e90dda04e..025357258d 100644 --- a/lib/System/Unix/Path.inc +++ b/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 { |
