From 9e39ea56ecb30453ffd0e88d0977efd4ef03a4a3 Mon Sep 17 00:00:00 2001 From: Laszlo Csomor Date: Wed, 15 Mar 2017 16:53:10 +0000 Subject: 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 --- src/main/cpp/util/file_windows.cc | 2 +- src/test/cpp/util/file_windows_test.cc | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') 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)); -- cgit v1.2.3