aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp/util/file_platform.h
diff options
context:
space:
mode:
authorGravatar Laszlo Csomor <laszlocsomor@google.com>2017-01-10 10:41:26 +0000
committerGravatar Marcel Hlopko <hlopko@google.com>2017-01-10 11:51:20 +0000
commit44ecf9a0c7c25496a43f59f1c8f20df9527e12cb (patch)
treec7580369cd3b0e7426b569d9638addaec4c00b0d /src/main/cpp/util/file_platform.h
parent12bf5ba34f70200eccc9e5f9b2f27d91d4514d77 (diff)
Windows: implement and use AsShortWindowsPath
Because CreateProcessW doesn't support long paths, not even with the "\\?\" prefix [1], we need to convert long paths to short ones to spawn processes. This change implements the corresponding function and uses it in blaze_util_windows. [1] https://github.com/bazelbuild/bazel/issues/2181#issuecomment-270696173 See https://github.com/bazelbuild/bazel/issues/2107 See https://github.com/bazelbuild/bazel/issues/2181 -- PiperOrigin-RevId: 144062404 MOS_MIGRATED_REVID=144062404
Diffstat (limited to 'src/main/cpp/util/file_platform.h')
-rw-r--r--src/main/cpp/util/file_platform.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/main/cpp/util/file_platform.h b/src/main/cpp/util/file_platform.h
index 9c95468e4b..91fc086627 100644
--- a/src/main/cpp/util/file_platform.h
+++ b/src/main/cpp/util/file_platform.h
@@ -133,6 +133,10 @@ void ForEachDirectoryEntry(const std::string &path,
// prepend the UNC prefix in case they need to pass it to a WinAPI function
// (some require the prefix, some don't), or to quote the path if necessary.
bool AsWindowsPath(const std::string &path, std::wstring *result);
+
+// Same as `AsWindowsPath`, but returns a lowercase 8dot3 style shortened path.
+// Result will never have a UNC prefix.
+bool AsShortWindowsPath(const std::string &path, std::string *result);
#endif // defined(COMPILER_MSVC) || defined(__CYGWIN__)
} // namespace blaze_util