24size_t RootLength(
const std::string&
path) {
29 if (
path[0] ==
'\\') {
30 if (
path.size() < 2 ||
path[1] !=
'\\')
34 size_t index =
path.find(
'\\', 2);
36 index =
path.find(
'\\', index + 1);
44 if (
path.length() >= 2 &&
path[1] ==
':' &&
45 (
path[2] ==
'/' ||
path[2] ==
'\\') &&
46 ((
path[0] >=
'A' &&
path[0] <=
'Z') ||
47 (
path[0] >=
'a' &&
path[0] <=
'z'))) {
53size_t IsSeparator(
const char sep) {
54 return sep ==
'/' ||
sep ==
'\\';
57size_t LastSeparator(
const std::string&
path) {
58 return path.find_last_of(
"/\\");
61size_t LastSeparator(
const std::string&
path,
size_t pos) {
62 return path.find_last_of(
"/\\",
pos);
65size_t FirstSeparator(
const std::string&
path,
size_t pos) {
66 return path.find_first_of(
"/\\",
pos);
69size_t ResolveParentDirectoryTraversal(
const std::string&
path,
72 if (put <= root_length) {
75 size_t previous_separator = LastSeparator(
path, put - 2);
76 if (previous_separator != std::string::npos)
77 return previous_separator + 1;
88 size_t traversal_root = 0;
89 size_t component_start = 0;
91 size_t rootLength = RootLength(
path);
95 component_start = rootLength;
101 if (c ==
'.' && (
get == component_start ||
get == component_start + 1)) {
108 if (IsSeparator(c)) {
109 if (
get == component_start ||
get == component_start + 1) {
112 component_start =
get;
115 if (
get == component_start + 2) {
118 if (put == traversal_root) {
122 traversal_root = put;
124 put = ResolveParentDirectoryTraversal(
path, put, rootLength);
127 component_start =
get;
132 size_t next_separator = FirstSeparator(
path,
get);
133 if (next_separator == std::string::npos) {
137 size_t next_component_start = next_separator + 1;
139 size_t component_size = next_component_start - component_start;
140 if (put != component_start && component_size > 0) {
141 path.replace(put, component_size,
142 path.substr(component_start, component_size));
144 put += component_size;
145 get = next_component_start;
146 component_start = next_component_start;
149 size_t last_component_size =
path.size() - component_start;
150 if (last_component_size == 1 &&
path[component_start] ==
'.') {
152 }
else if (last_component_size == 2 &&
path[component_start] ==
'.' &&
153 path[component_start + 1] ==
'.') {
156 if (put == traversal_root) {
160 traversal_root = put;
162 put = ResolveParentDirectoryTraversal(
path, put, rootLength);
166 if (put != component_start && last_component_size > 0) {
167 path.replace(put, last_component_size,
168 path.substr(component_start, last_component_size));
170 put += last_component_size;
173 if (put >= 2 && IsSeparator(
path[put - 1]))
179 std::replace(
path.begin(),
path.end(),
'/',
'\\');
186 return std::string(absPath);
190 size_t rootLength = RootLength(
path);
191 size_t separator = LastSeparator(
path);
192 if (separator < rootLength)
193 separator = rootLength;
194 if (separator == std::string::npos)
195 return std::string();
196 return path.substr(0, separator);
200 size_t separator = LastSeparator(
path);
201 if (separator == std::string::npos)
203 return path.substr(separator + 1);
208 CreateFileA(
path.c_str(), FILE_READ_ATTRIBUTES,
209 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
210 OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
212 return std::string();
235 result.erase(0, strlen(
"\\\\?\\"));
std::string GetBaseName(const std::string &path)
std::string AbsolutePath(const std::string &path)
std::string GetAbsoluteFilePath(const std::string &path)
std::string GetDirectoryName(const std::string &path)
std::string SimplifyPath(std::string path)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
const myers::Point & get(const myers::Segment &)
#define INVALID_HANDLE_VALUE
WINBASEAPI _Check_return_ _Post_equals_last_error_ DWORD WINAPI GetLastError(VOID)
#define ERROR_ACCESS_DENIED