Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

also accept paths with slashes on windows #322

Closed
wants to merge 1 commit into from

1 participant

@syntheticpp

Background:

ar.exe on Windows doesn't like back slashes in a response file, therefore we (cmake) use slashes as directory separator for mingw build files. Only then ninja writes slashes to the response file.

Also on Windows a slash could not be part of a filename, so this patch is not critical.

@syntheticpp

fixed in generator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jun 6, 2012
  1. @syntheticpp
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 7 deletions.
  1. +10 −7 src/disk_interface.cc
View
17 src/disk_interface.cc
@@ -27,13 +27,7 @@
namespace {
-string DirName(const string& path) {
-#ifdef _WIN32
- const char kPathSeparator = '\\';
-#else
- const char kPathSeparator = '/';
-#endif
-
+string DirName(const string& path, const char kPathSeparator) {
string::size_type slash_pos = path.rfind(kPathSeparator);
if (slash_pos == string::npos)
return string(); // Nothing to do.
@@ -42,6 +36,15 @@ string DirName(const string& path) {
return path.substr(0, slash_pos);
}
+string DirName(const string& path) {
+#ifdef _WIN32
+ std::string dir = DirName(path, '\\');
+ if (!dir.empty())
+ return dir;
+#endif
+ return DirName(path, '/');
+}
+
} // namespace
// DiskInterface ---------------------------------------------------------------
Something went wrong with that request. Please try again.