aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp/util/file_windows.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/cpp/util/file_windows.cc')
-rw-r--r--src/main/cpp/util/file_windows.cc36
1 files changed, 6 insertions, 30 deletions
diff --git a/src/main/cpp/util/file_windows.cc b/src/main/cpp/util/file_windows.cc
index 758bfb71dc..2b4a105f05 100644
--- a/src/main/cpp/util/file_windows.cc
+++ b/src/main/cpp/util/file_windows.cc
@@ -38,12 +38,6 @@ using std::wstring;
// The result may have a UNC prefix.
static unique_ptr<WCHAR[]> GetCwdW();
-// Returns true the file or junction at `path` is successfully deleted.
-// Returns false otherwise, or if `path` doesn't exist or is a directory.
-// `path` must be a normalized Windows path, with UNC prefix (and absolute) if
-// necessary.
-static bool UnlinkPathW(const wstring& path);
-
// Like `AsWindowsPath` but the result is absolute and has UNC prefix if needed.
static bool AsWindowsPathWithUncPrefix(const string& path, wstring* wpath);
@@ -390,32 +384,14 @@ bool WriteFile(const void* data, size_t size, const string& filename) {
#else // not COMPILER_MSVC
#endif // COMPILER_MSVC
-static bool UnlinkPathW(const wstring& path) {
- DWORD attrs = ::GetFileAttributesW(path.c_str());
- if (attrs == INVALID_FILE_ATTRIBUTES) {
- // Path does not exist.
- return false;
- }
- if (attrs & FILE_ATTRIBUTE_DIRECTORY) {
- if (!(attrs & FILE_ATTRIBUTE_REPARSE_POINT)) {
- // Path is a directory; unlink(2) also cannot remove directories.
- return false;
- }
- // Otherwise it's a junction, remove using RemoveDirectoryW.
- return ::RemoveDirectoryW(path.c_str()) == TRUE;
- } else {
- // Otherwise it's a file, remove using DeleteFileW.
- return ::DeleteFileW(path.c_str()) == TRUE;
- }
-}
-
+#ifdef COMPILER_MSVC
bool UnlinkPath(const string& file_path) {
- wstring wpath;
- if (!AsWindowsPathWithUncPrefix(file_path, &wpath)) {
- return false;
- }
- return UnlinkPathW(wpath);
+ // TODO(bazel-team): implement this.
+ pdie(255, "blaze_util::UnlinkPath is not implemented on Windows");
+ return false;
}
+#else // not COMPILER_MSVC
+#endif // COMPILER_MSVC
HANDLE OpenDirectory(const WCHAR* path, bool read_write) {
return ::CreateFileW(