diff options
author | Yun Peng <pcloudy@google.com> | 2018-05-14 02:53:01 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-05-14 02:54:17 -0700 |
commit | f96f037f8f77335dc444844abcc31a372a3e1849 (patch) | |
tree | 27e5f8adededa0817c2758dc965aa42dcb2db67a /src/main/cpp | |
parent | 43181c9363473baed3de071a320e1da23ac45d26 (diff) |
Windows, Java launcher: Support jar files under different drives
Create junctions to jar's directory when java launcher and its jar are under different drives
Fixed https://github.com/bazelbuild/bazel/issues/5135
Change-Id: I21c5b28f5f36c1fe234f8b781fe40d526db846cc
PiperOrigin-RevId: 196477704
Diffstat (limited to 'src/main/cpp')
-rw-r--r-- | src/main/cpp/util/file.cc | 4 | ||||
-rw-r--r-- | src/main/cpp/util/file_windows.cc | 4 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/main/cpp/util/file.cc b/src/main/cpp/util/file.cc index 16e8a08a52..3eb614c0dc 100644 --- a/src/main/cpp/util/file.cc +++ b/src/main/cpp/util/file.cc @@ -124,8 +124,8 @@ class DirectoryTreeWalker : public DirectoryEntryConsumer { _ForEachDirectoryEntry walk_entries) : _files(files), _walk_entries(walk_entries) {} - void Consume(const string &path, bool is_directory) override { - if (is_directory) { + void Consume(const string &path, bool follow_directory) override { + if (follow_directory) { Walk(path); } else { _files->push_back(path); diff --git a/src/main/cpp/util/file_windows.cc b/src/main/cpp/util/file_windows.cc index 124ae7ed17..39160c9c22 100644 --- a/src/main/cpp/util/file_windows.cc +++ b/src/main/cpp/util/file_windows.cc @@ -1219,7 +1219,9 @@ void ForEachDirectoryEntry(const string &path, wstring wname = wpath + metadata.cFileName; string name(WstringToCstring(/* omit prefix */ 4 + wname.c_str()).get()); bool is_dir = (metadata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0; - consume->Consume(name, is_dir); + bool is_junc = + (metadata.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0; + consume->Consume(name, is_dir && !is_junc); } } while (::FindNextFileW(handle, &metadata)); ::FindClose(handle); |