5#include "flutter/fml/paths.h"
11#include "flutter/fml/paths.h"
12#include "flutter/fml/platform/win/wstring_conversion.h"
19constexpr char kFileURLPrefix[] =
"file:///";
20constexpr size_t kFileURLPrefixLength =
sizeof(kFileURLPrefix) - 1;
22size_t RootLength(
const std::string&
path) {
27 if (
path[0] ==
'\\') {
28 if (
path.size() < 2 ||
path[1] !=
'\\')
32 size_t index =
path.find(
'\\', 2);
34 index =
path.find(
'\\', index + 1);
42 if (
path.length() >= 2 &&
path[1] ==
':' &&
43 (
path[2] ==
'/' ||
path[2] ==
'\\') &&
44 ((
path[0] >=
'A' &&
path[0] <=
'Z') ||
45 (
path[0] >=
'a' &&
path[0] <=
'z'))) {
51size_t LastSeparator(
const std::string&
path) {
52 return path.find_last_of(
"/\\");
58 HMODULE module = GetModuleHandle(NULL);
64 if (read_size == 0 || read_size ==
MAX_PATH) {
73 return std::string(absPath);
77 size_t rootLength = RootLength(
path);
78 size_t separator = LastSeparator(
path);
79 if (separator < rootLength)
80 separator = rootLength;
81 if (separator == std::string::npos)
83 return path.substr(0, separator);
86std::string
FromURI(
const std::string& uri) {
87 if (uri.substr(0, kFileURLPrefixLength) != kFileURLPrefix)
90 std::string file_path = uri.substr(kFileURLPrefixLength);
91 std::replace(file_path.begin(), file_path.end(),
'/',
'\\');
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
std::pair< bool, std::string > GetExecutablePath()
std::string AbsolutePath(const std::string &path)
fml::UniqueFD GetCachesDirectory()
std::string SanitizeURIEscapedCharacters(const std::string &str)
std::string GetDirectoryName(const std::string &path)
std::string FromURI(const std::string &uri)
std::string WideStringToUtf8(const std::wstring_view str)