Skip to content

Commit

Permalink
Update max path length to be 256 (MAX_PATH - 4)
Browse files Browse the repository at this point in the history
  • Loading branch information
mai93 committed Feb 19, 2021
1 parent f6519c1 commit 0ee857c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main/native/windows/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ static bool Contains(const wstring& s, const WCHAR* substr) {
}

wstring AsShortPath(wstring path, wstring* result) {
// Using MAX_PATH - 2 instead of MAX_PATH to fix https://github.com/bazelbuild/bazel/issues/12310
static const size_t kMaxPath = MAX_PATH - 2;
// Using MAX_PATH - 4 (256) instead of MAX_PATH to fix https://github.com/bazelbuild/bazel/issues/12310
static const size_t kMaxPath = MAX_PATH - 4;

if (path.empty()) {
result->clear();
Expand Down
4 changes: 2 additions & 2 deletions src/test/native/windows/util_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ using std::unique_ptr;
using std::wstring;

static const wstring kUncPrefix = wstring(L"\\\\?\\");
// Using MAX_PATH - 2 instead of MAX_PATH to fix https://github.com/bazelbuild/bazel/issues/12310
static const size_t kMaxPath = MAX_PATH - 2;
// Using MAX_PATH - 4 instead of MAX_PATH to fix https://github.com/bazelbuild/bazel/issues/12310
static const size_t kMaxPath = MAX_PATH - 4;

// Retrieves TEST_TMPDIR as a shortened path. Result won't have a "\\?\" prefix.
static void GetShortTempDir(wstring* result) {
Expand Down

0 comments on commit 0ee857c

Please sign in to comment.