blob: 84993a0c174896e950db9afc91fb3519a8afb5c6 [file] [log] [blame]
From 0ded2b5e1c163ca5a1e529c7e3e3e5f44d1046de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= <mati865@gmail.com>
Date: Fri, 20 Nov 2020 13:01:23 +0100
Subject: Use posix style path separators with MinGW
---
tools/driver/driver.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp
index f24fd61e61a..717e6d11f18 100644
--- a/tools/driver/driver.cpp
+++ b/tools/driver/driver.cpp
@@ -62,7 +62,12 @@ std::string GetExecutablePath(const char *Argv0, bool CanonicalPrefixes) {
if (llvm::ErrorOr<std::string> P =
llvm::sys::findProgramByName(ExecutablePath))
ExecutablePath = *P;
+#ifndef __MINGW32__
return std::string(ExecutablePath.str());
+#else
+ return llvm::sys::path::convert_to_slash(std::string(ExecutablePath.str()),
+ llvm::sys::path::Style::windows);
+#endif
}
// This just needs to be some symbol in the binary; C++ doesn't
@@ -296,7 +301,12 @@ static void SetInstallDir(SmallVectorImpl<const char *> &argv,
// Attempt to find the original path used to invoke the driver, to determine
// the installed path. We do this manually, because we want to support that
// path being a symlink.
+#ifndef __MINGW32__
SmallString<128> InstalledPath(argv[0]);
+#else
+ SmallString<128> InstalledPath(llvm::sys::path::convert_to_slash(
+ argv[0], llvm::sys::path::Style::windows));
+#endif
// Do a PATH lookup, if there are no directory components.
if (llvm::sys::path::filename(InstalledPath) == InstalledPath)
--
2.29.2.windows.2