Bazel client: simplify ReadDirectorySymlink
This is a bugfixed version of
https://cr.bazel.build/9520 which broke some
Google-internal tests.
This change allows removing duplicate code:
ReadDirectorySymlink was implemented on Windows as
a junction resolver, which is also implemented in
file_windows.cc. Now it uses the JunctionResolver.
RELNOTES: none
PiperOrigin-RevId: 151691895
diff --git a/src/main/cpp/util/file_platform.h b/src/main/cpp/util/file_platform.h
index 50b75de..31a0d1c 100644
--- a/src/main/cpp/util/file_platform.h
+++ b/src/main/cpp/util/file_platform.h
@@ -130,6 +130,11 @@
// Returns one of the RenameDirectoryResult enum values.
int RenameDirectory(const std::string &old_name, const std::string &new_name);
+// Reads which directory a symlink points to. Puts the target of the symlink
+// in ``result`` and returns if the operation was successful. Will not work on
+// symlinks that don't point to directories on Windows.
+bool ReadDirectorySymlink(const std::string &symlink, std::string *result);
+
// Unlinks the file given by 'file_path'.
// Returns true on success. In case of failure sets errno.
bool UnlinkPath(const std::string &file_path);