f9c603e76b
This ensures that on Windows we take advantage of 32k-character file name limit consistently for all files and directories operations. TEST=ci BUG=https://github.com/dart-lang/sdk/issues/56125 BUG=https://github.com/dart-lang/sdk/issues/55972 CoreLibraryReviewExempt: adds windows-specific error code for invalid file name Change-Id: I83bd3ceac579e589469e47b2cf5216db457cae8b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375421 Reviewed-by: Slava Egorov <vegorov@google.com> Commit-Queue: Alexander Aprelev <aam@google.com>
30 lines
993 B
C++
30 lines
993 B
C++
// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
#ifndef RUNTIME_BIN_FILE_WIN_H_
|
|
#define RUNTIME_BIN_FILE_WIN_H_
|
|
|
|
#include <memory>
|
|
|
|
#include "bin/file.h"
|
|
|
|
// The limit for a regular directory is 248.
|
|
// Reference: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation
|
|
#define MAX_DIRECTORY_PATH (MAX_PATH - 12)
|
|
|
|
namespace dart {
|
|
namespace bin {
|
|
|
|
// Converts the given UTF8 path to wide char '\\?\'-prefix absolute path.
|
|
//
|
|
// Note that some WinAPI functions (like SetCurrentDirectoryW) are always
|
|
// limited to MAX_PATH long paths and converting to `\\?\`-prefixed form does
|
|
// not remove this limitation. Always check Win API documentation.
|
|
std::unique_ptr<wchar_t[]> ToWinAPIPath(const char* path);
|
|
|
|
} // namespace bin
|
|
} // namespace dart
|
|
|
|
#endif // RUNTIME_BIN_FILE_WIN_H_
|