diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-14 21:41:33 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2013-06-14 21:41:33 +0000 |
commit | 9e89fe77ce532e1d2704f55159d5474b35645685 (patch) | |
tree | 10c34879e5a5b635997f4522ae28ffe95c94208e /lib/Support/Windows/Path.inc | |
parent | a553bede23578dbf5233a28b1e67183d0911096c (diff) | |
download | external_llvm-9e89fe77ce532e1d2704f55159d5474b35645685.zip external_llvm-9e89fe77ce532e1d2704f55159d5474b35645685.tar.gz external_llvm-9e89fe77ce532e1d2704f55159d5474b35645685.tar.bz2 |
Add GetCurrentDirectory back.
It looks like clang-tools-extra/unittests/cpp11-migrate/TransformTest.cpp
depends on the behaviour of the old one on Windows. Maybe a difference
between GetCurrentDirectoryA and GetCurrentDirectoryW?
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184009 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/Windows/Path.inc')
-rw-r--r-- | lib/Support/Windows/Path.inc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc index bb1f77a..4a6e563 100644 --- a/lib/Support/Windows/Path.inc +++ b/lib/Support/Windows/Path.inc @@ -20,6 +20,9 @@ #include <cstdio> #include <malloc.h> +// We need to undo a macro defined in Windows.h, otherwise we won't compile: +#undef GetCurrentDirectory + // Windows happily accepts either forward or backward slashes, though any path // returned by a Win32 API will have backward slashes. As LLVM code basically // assumes forward slashes are used, backward slashs are converted where they @@ -196,6 +199,13 @@ Path::GetTemporaryDirectory(std::string* ErrMsg) { return *TempDirectory; } +Path +Path::GetCurrentDirectory() { + char pathname[MAX_PATH]; + ::GetCurrentDirectoryA(MAX_PATH,pathname); + return Path(pathname); +} + /// GetMainExecutable - Return the path to the main executable, given the /// value of argv[0] from program startup. Path Path::GetMainExecutable(const char *argv0, void *MainAddr) { |