Skip to content

Commit

Permalink
Update threshold for long path shortening to be 158 not 160
Browse files Browse the repository at this point in the history
  • Loading branch information
mai93 committed Feb 1, 2021
1 parent bb6af8b commit 5b2b73f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/native/windows/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,8 @@ wstring AsShortPath(wstring path, wstring* result) {
return MakeErrorMessage(WSTR(__FILE__), __LINE__, L"AsShortPath", path,
L"path is not normalized");
}
if (path.size() >= MAX_PATH && !HasSeparator(path)) {
// Comparing to MAX_PATH - 2 to fix https://github.com/bazelbuild/bazel/issues/12310
if (path.size() >= MAX_PATH - 2 && !HasSeparator(path)) {
return MakeErrorMessage(WSTR(__FILE__), __LINE__, L"AsShortPath", path,
L"path is just a file name but too long");
}
Expand All @@ -225,7 +226,8 @@ wstring AsShortPath(wstring path, wstring* result) {

std::replace(path.begin(), path.end(), '/', '\\');
// Fast-track: the path is already short.
if (path.size() < MAX_PATH) {
// Comparing to MAX_PATH - 2 to fix https://github.com/bazelbuild/bazel/issues/12310
if (path.size() < MAX_PATH - 2) {
*result = path;
return L"";
}
Expand Down

0 comments on commit 5b2b73f

Please sign in to comment.