Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
file_win.h
Go to the documentation of this file.
1// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
2// for details. All rights reserved. Use of this source code is governed by a
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_BIN_FILE_WIN_H_
6#define RUNTIME_BIN_FILE_WIN_H_
7
8#include <memory>
9
10#include "bin/file.h"
11
12// The limit for a regular directory is 248.
13// Reference: https://docs.microsoft.com/en-us/windows/win32/fileio/naming-a-file#maximum-path-length-limitation
14#define MAX_DIRECTORY_PATH (MAX_PATH - 12)
15
16namespace dart {
17namespace bin {
18
19// Converts the given UTF8 path to wide char. If resulting path does not
20// fit into MAX_DIRECTORY_PATH (or if |force_long_prefix| is true) then
21// converts the path to the absolute `\\?\`-prefixed form.
22//
23// Note:
24// 1. Some WinAPI functions (like SetCurrentDirectoryW) are always limited
25// to MAX_PATH long paths and converting to `\\?\`-prefixed form does not
26// remove this limitation. Always check Win API documentation.
27// 2. This function might change relative path to an absolute path.
28std::unique_ptr<wchar_t[]> ToWinAPIDirectoryPath(
29 const char* path,
30 bool force_long_prefix = false);
31
32} // namespace bin
33} // namespace dart
34
35#endif // RUNTIME_BIN_FILE_WIN_H_
std::unique_ptr< wchar_t[]> ToWinAPIDirectoryPath(const char *path, bool force_long_prefix=false)