summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Windows/Path.inc
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-14 21:41:33 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-14 21:41:33 +0000
commit158d537c5a0ae834a2899121d1da693af8f78859 (patch)
treed4cd024736c813f4f22cfd0ab7263ecf1efd6f7f /llvm/lib/Support/Windows/Path.inc
parent4e69d01b678a85b45245ecb4724177082013d236 (diff)
downloadbcm5719-llvm-158d537c5a0ae834a2899121d1da693af8f78859.tar.gz
bcm5719-llvm-158d537c5a0ae834a2899121d1da693af8f78859.zip
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? llvm-svn: 184009
Diffstat (limited to 'llvm/lib/Support/Windows/Path.inc')
-rw-r--r--llvm/lib/Support/Windows/Path.inc10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc
index bb1f77ab23c..4a6e56350b4 100644
--- a/llvm/lib/Support/Windows/Path.inc
+++ b/llvm/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) {
OpenPOWER on IntegriCloud