26size_t ResolveParentDirectoryTraversal(
const std::string&
path,
size_t put) {
28 size_t previous_separator =
path.rfind(
'/', put - 2);
29 if (previous_separator != std::string::npos)
30 return previous_separator + 1;
32 if (put == 1 &&
path[0] ==
'/') {
43 return std::string(
buffer);
54 size_t traversal_root = 0;
55 size_t component_start = 0;
66 if (c ==
'.' && (
get == component_start ||
get == component_start + 1)) {
74 if (
get == component_start ||
get == component_start + 1) {
77 component_start =
get;
80 if (
get == component_start + 2) {
83 if (put == traversal_root) {
89 put = ResolveParentDirectoryTraversal(
path, put);
92 component_start =
get;
97 size_t next_separator =
path.find(
'/',
get);
98 if (next_separator == std::string::npos) {
102 size_t next_component_start = next_separator + 1;
104 size_t component_size = next_component_start - component_start;
105 if (put != component_start && component_size > 0) {
106 path.replace(put, component_size,
107 path.substr(component_start, component_size));
109 put += component_size;
110 get = next_component_start;
111 component_start = next_component_start;
114 size_t last_component_size =
path.size() - component_start;
115 if (last_component_size == 1 &&
path[component_start] ==
'.') {
117 }
else if (last_component_size == 2 &&
path[component_start] ==
'.' &&
118 path[component_start + 1] ==
'.') {
121 if (put == traversal_root) {
125 traversal_root = put;
127 put = ResolveParentDirectoryTraversal(
path, put);
131 if (put != component_start && last_component_size > 0) {
132 path.replace(put, last_component_size,
133 path.substr(component_start, last_component_size));
135 put += last_component_size;
138 if (put >= 2 &&
path[put - 1] ==
'/')
149 if (
path[0] ==
'/') {
161 size_t separator =
path.rfind(
'/');
164 if (separator == std::string::npos)
165 return std::string();
166 return path.substr(0, separator);
170 size_t separator =
path.rfind(
'/');
171 if (separator == std::string::npos)
173 return path.substr(separator + 1);
177#if defined(OS_FUCHSIA)
182 if (realpath(
path.c_str(),
buffer) ==
nullptr)
183 return std::string();
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 GetCurrentDirectory