aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2017-03-15 16:53:10 +0000
committerGravatar Yun Peng <pcloudy@google.com>2017-03-16 08:35:49 +0000
commit9e39ea56ecb30453ffd0e88d0977efd4ef03a4a3 (patch)
tree8d0defa5761d661d73d2ef162c27f665ca6a7d37 /src
parente4d2b1d5bd6a1ec0ccc060d1355fe1196a7d389c (diff)
Bazel client, Windows: support "d:/" output root
Support drive roots as --output_user_root values, so "d:\" and "d:/" will now work. However "d:" doesn't work yet because that's shorthand for the current working directory on "D:". See https://github.com/bazelbuild/bazel/issues/2683 -- PiperOrigin-RevId: 150203657 MOS_MIGRATED_REVID=150203657
Diffstat (limited to 'src')
-rw-r--r--src/main/cpp/util/file_windows.cc2
-rw-r--r--src/test/cpp/util/file_windows_test.cc7
2 files changed, 4 insertions, 5 deletions
diff --git a/src/main/cpp/util/file_windows.cc b/src/main/cpp/util/file_windows.cc
index 5159917eb4..66c0197d47 100644
--- a/src/main/cpp/util/file_windows.cc
+++ b/src/main/cpp/util/file_windows.cc
@@ -1117,7 +1117,7 @@ static bool MakeDirectoriesW(const wstring& path) {
bool MakeDirectories(const string& path, unsigned int mode) {
// TODO(laszlocsomor): respect `mode` to the extent that it's possible on
// Windows; it's currently ignored.
- if (path.empty() || IsDevNull(path) || IsRootDirectory(path)) {
+ if (path.empty() || IsDevNull(path)) {
return false;
}
wstring wpath;
diff --git a/src/test/cpp/util/file_windows_test.cc b/src/test/cpp/util/file_windows_test.cc
index 53116f8076..45e95384ae 100644
--- a/src/test/cpp/util/file_windows_test.cc
+++ b/src/test/cpp/util/file_windows_test.cc
@@ -38,7 +38,6 @@ using std::wstring;
// Methods defined in file_windows.cc that are only visible for testing.
bool AsWindowsPath(const string& path, wstring* result);
-bool AsWindowsPathWithUncPrefix(const string& path, wstring* wpath);
void ResetMsysRootForTesting();
string NormalizeWindowsPath(string path);
@@ -421,9 +420,9 @@ TEST_F(FileWindowsTest, TestMakeDirectories) {
// Test that we can create come directories, can't create others.
ASSERT_FALSE(MakeDirectories("", 0777));
ASSERT_FALSE(MakeDirectories("/dev/null", 0777));
- ASSERT_FALSE(MakeDirectories("c:/", 0777));
- ASSERT_FALSE(MakeDirectories("c:\\", 0777));
- ASSERT_FALSE(MakeDirectories("/", 0777));
+ ASSERT_TRUE(MakeDirectories("c:/", 0777));
+ ASSERT_TRUE(MakeDirectories("c:\\", 0777));
+ ASSERT_TRUE(MakeDirectories("/", 0777));
ASSERT_TRUE(MakeDirectories("/foo", 0777));
ASSERT_TRUE(MakeDirectories(".", 0777));
ASSERT_TRUE(MakeDirectories(tmpdir, 0777));