6#if defined(DART_HOST_OS_WINDOWS)
43 int fd()
const {
return fd_; }
44 void set_fd(
int fd) {
fd_ =
fd; }
53 if (!
IsClosed() && handle_->
fd() != _fileno(stdout) &&
54 handle_->
fd() != _fileno(stderr)) {
62 int closing_fd = handle_->
fd();
63 if ((closing_fd == _fileno(stdout)) || (closing_fd == _fileno(stderr))) {
64 int fd = _open(
"NUL", _O_WRONLY);
66 _dup2(fd, closing_fd);
74 handle_->set_fd(kClosedFd);
82 return handle_->
fd() == kClosedFd;
93 prot_alloc = PAGE_READWRITE;
94 prot_final = PAGE_READONLY;
97 prot_alloc = PAGE_EXECUTE_READWRITE;
98 prot_final = PAGE_EXECUTE_READ;
101 prot_alloc = PAGE_READWRITE;
102 prot_final = PAGE_READWRITE;
107 if (
addr ==
nullptr) {
108 addr = VirtualAlloc(
nullptr,
length, MEM_COMMIT | MEM_RESERVE, prot_alloc);
109 if (
addr ==
nullptr) {
115 const int64_t remaining_length =
Length() - position;
119 if (start ==
nullptr) {
120 VirtualFree(
addr, 0, MEM_RELEASE);
127 if (
length > remaining_length) {
128 memset(
reinterpret_cast<uint8_t*
>(
addr) + remaining_length, 0,
129 length - remaining_length);
136 if (start ==
nullptr) {
137 VirtualFree(
addr, 0, MEM_RELEASE);
141 return new MappedMemory(
addr,
length, start ==
nullptr);
144void MappedMemory::Unmap() {
145 BOOL result = VirtualFree(address_, 0, MEM_RELEASE);
157 int fd = handle_->
fd();
159 ASSERT(fd >= 0 && num_bytes <= MAXDWORD && num_bytes >= 0);
160 HANDLE handle =
reinterpret_cast<HANDLE>(_get_osfhandle(fd));
167 int64_t bytes_written =
written;
168 if (GetConsoleMode(handle, &
mode)) {
177 wchar_t* wide =
new wchar_t[
written];
178 int cp = GetConsoleOutputCP();
179 MultiByteToWideChar(cp, 0,
reinterpret_cast<const char*
>(
buffer), -1, wide,
182 WideCharToMultiByte(cp, 0, wide,
written,
nullptr, 0,
nullptr,
nullptr);
184 bytes_written = buffer_len;
186 return bytes_written;
191 va_list measure_args;
192 va_copy(measure_args,
args);
193 intptr_t
len = _vscprintf(
format, measure_args);
200 va_copy(print_args,
args);
211 HANDLE handle =
reinterpret_cast<HANDLE>(_get_osfhandle(handle_->
fd()));
212 LARGE_INTEGER zero_offset;
213 zero_offset.QuadPart = 0;
214 LARGE_INTEGER position;
215 if (!SetFilePointerEx(handle, zero_offset, &position, FILE_CURRENT)) {
218 return position.QuadPart;
223 HANDLE handle =
reinterpret_cast<HANDLE>(_get_osfhandle(handle_->
fd()));
224 LARGE_INTEGER requested_position;
225 requested_position.QuadPart = position;
226 return SetFilePointerEx(handle, requested_position,
227 nullptr, FILE_BEGIN);
234 HANDLE handle =
reinterpret_cast<HANDLE>(_get_osfhandle(handle_->
fd()));
235 return SetEndOfFile(handle);
240 HANDLE handle =
reinterpret_cast<HANDLE>(_get_osfhandle(handle_->
fd()));
241 return FlushFileBuffers(handle);
246 ASSERT((end == -1) || (end > start));
247 HANDLE handle =
reinterpret_cast<HANDLE>(_get_osfhandle(handle_->
fd()));
264 rc = UnlockFileEx(handle, 0, length_low, length_high, &overlapped);
272 flags |= LOCKFILE_FAIL_IMMEDIATELY;
276 flags |= LOCKFILE_EXCLUSIVE_LOCK;
278 rc = LockFileEx(handle,
flags, 0, length_low, length_high, &overlapped);
290 if (_fstat64(
handle_->fd(), &st) == 0) {
296File* File::FileOpenW(
const wchar_t* system_name, FileOpenMode
mode) {
297 int flags = O_RDONLY | O_BINARY | O_NOINHERIT;
300 flags = (O_RDWR | O_CREAT | O_BINARY | O_NOINHERIT);
304 flags = (O_WRONLY | O_CREAT | O_BINARY | O_NOINHERIT);
309 int fd = _wopen(system_name,
flags, 0666);
315 int64_t position = _lseeki64(fd, 0, SEEK_END);
324 return new File(
new FileHandle(fd));
327static std::unique_ptr<wchar_t[]> ConvertToAbsolutePath(
328 const std::unique_ptr<
wchar_t[]>&
path) {
334 int full_path_length =
337 if (full_path_length == 0) {
354 if (pathname ==
nullptr)
return false;
355 char first = pathname[0];
356 char second = pathname[1];
357 if (first ==
L'\\' && second ==
L'\\')
return true;
358 if (second !=
L':')
return false;
360 char third = pathname[2];
361 return (first >=
L'a') && (first <=
L'z') &&
362 (third ==
L'\\' || third ==
L'/');
365const wchar_t* kLongPathPrefix =
L"\\\\?\\";
366const int kLongPathPrefixLength = 4;
370const wchar_t* kDeviceNamespacePrefix =
L"\\\\.\\";
371const int kDeviceNamespacePrefixLength = 4;
373static bool IsLongPathPrefixed(
const std::unique_ptr<
wchar_t[]>&
path) {
374 return wcsncmp(
path.get(), kLongPathPrefix, kLongPathPrefixLength) == 0;
377static bool IsDeviceNamespacePrefixed(
const std::unique_ptr<
wchar_t[]>&
path) {
378 return wcsncmp(
path.get(), kDeviceNamespacePrefix,
379 kDeviceNamespacePrefixLength) == 0;
397static std::unique_ptr<wchar_t[]> ToWinAPIPath(
const char* utf8_path,
399 bool force_long_prefix) {
406 std::unique_ptr<wchar_t[]> absolute_path;
408 absolute_path = ConvertToAbsolutePath(
path);
409 if (absolute_path ==
nullptr) {
413 absolute_path = std::move(
path);
416 int path_length = wcslen(absolute_path.get());
418 if (!force_long_prefix && path_length < path_short_limit) {
419 if (
path ==
nullptr) {
420 return absolute_path;
426 if (IsLongPathPrefixed(absolute_path) ||
427 IsDeviceNamespacePrefixed(absolute_path)) {
428 return absolute_path;
433 const bool is_unc = (wcsncmp(absolute_path.get(),
L"\\\\", 2) == 0);
434 const wchar_t* kUNCLongPathPrefix =
L"\\\\?\\UNC\\";
435 const int kUNCLongPathPrefixLength = 8;
441 const intptr_t result_length =
442 (is_unc ? kUNCLongPathPrefixLength : kLongPathPrefixLength) +
443 path_length + (is_unc ? -2 : 0) + 1;
444 auto result = std::make_unique<wchar_t[]>(result_length);
448 wcsncpy(
result.get(), kUNCLongPathPrefix, kUNCLongPathPrefixLength);
449 result_pos = kUNCLongPathPrefixLength;
452 wcsncpy(
result.get(), kLongPathPrefix, kLongPathPrefixLength);
453 result_pos = kLongPathPrefixLength;
456 while (path_pos < path_length) {
457 wchar_t ch = absolute_path[path_pos++];
458 result.get()[result_pos++] = ch ==
L'/' ?
L'\\' : ch;
460 result.get()[result_pos++] =
L'\0';
461 ASSERT(result_pos == result_length);
474static std::unique_ptr<wchar_t[]> ToWinAPIFilePath(
476 bool force_long_prefix =
false) {
477 return ToWinAPIPath(
path,
true, force_long_prefix);
482 bool force_long_prefix ) {
483 return ToWinAPIPath(
path,
false, force_long_prefix);
487 const auto path = ToWinAPIFilePath(
name);
493 UriDecoder uri_decoder(uri);
494 if (uri_decoder.decoded() ==
nullptr) {
500 if (!UrlIsFileUrlW(uri_w.get())) {
505 HRESULT
result = PathCreateFromUrlW(uri_w.get(), filename_w, &filename_len,
511 WideToUtf8Scope utf8_path(filename_w);
512 return utf8_path.release();
517 if (
path ==
nullptr) {
527 stdio_fd = _fileno(stdout);
530 stdio_fd = _fileno(stderr);
535 _setmode(stdio_fd, _O_BINARY);
536 return new File(
new FileHandle(stdio_fd));
539static bool StatHelper(
const wchar_t*
path,
struct __stat64* st) {
540 int stat_status = _wstat64(
path, st);
541 if (stat_status != 0) {
544 if ((st->st_mode & S_IFMT) != S_IFREG) {
553 return StatHelper(
path, &st);
557 const auto path = ToWinAPIFilePath(
name);
562 UriDecoder uri_decoder(uri);
563 if (uri_decoder.decoded() ==
nullptr) {
571 const auto path = ToWinAPIFilePath(
name);
572 int flags = O_RDONLY | O_CREAT;
576 int fd = _wopen(
path.get(),
flags, 0666);
584typedef struct _REPARSE_DATA_BUFFER {
586 USHORT ReparseDataLength;
591 USHORT SubstituteNameOffset;
592 USHORT SubstituteNameLength;
593 USHORT PrintNameOffset;
594 USHORT PrintNameLength;
597 } SymbolicLinkReparseBuffer;
600 USHORT SubstituteNameOffset;
601 USHORT SubstituteNameLength;
602 USHORT PrintNameOffset;
603 USHORT PrintNameLength;
605 } MountPointReparseBuffer;
609 } GenericReparseBuffer;
611} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
614 const char* utf8_name,
615 const char* utf8_target) {
616 const auto name = ToWinAPIFilePath(utf8_name);
618 std::unique_ptr<wchar_t[]>
target;
619 bool target_is_directory;
621 target = ToWinAPIFilePath(utf8_target);
622 target_is_directory =
645 intptr_t target_path_max_length =
646 wcslen(
name.get()) + wcslen(
target.get()) + 2;
647 auto target_path = std::make_unique<wchar_t[]>(target_path_max_length);
648 wcscpy_s(target_path.get(), target_path_max_length,
name.get());
651 HRESULT remove_result =
652 PathCchRemoveFileSpec(target_path.get(), target_path_max_length);
653 if (remove_result == S_FALSE) {
659 }
else if (remove_result != S_OK) {
665 HRESULT combine_result = PathCchCombineEx(
666 target_path.get(), target_path_max_length, target_path.get(),
667 target.get(), PATHCCH_ALLOW_LONG_PATHS);
668 if (combine_result != S_OK) {
673 target_is_directory =
677 DWORD flags = SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE;
678 if (target_is_directory) {
679 flags |= SYMBOLIC_LINK_FLAG_DIRECTORY;
681 int create_status = CreateSymbolicLinkW(
name.get(),
target.get(),
flags);
686 if ((create_status == 0) && (
GetLastError() == ERROR_INVALID_PARAMETER)) {
687 flags &= ~SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE;
691 return (create_status != 0);
694bool File::CreatePipe(Namespace* namespc, File** readPipe, File** writePipe) {
696 int status = _pipe(pipe_fds, 4096, _O_BINARY);
700 *readPipe =
OpenFD(pipe_fds[0]);
701 *writePipe =
OpenFD(pipe_fds[1]);
706 const auto path = ToWinAPIFilePath(
name);
707 int status = _wremove(
path.get());
711static bool DeleteLinkHelper(
const wchar_t*
path) {
713 DWORD attributes = GetFileAttributesW(
path);
714 if ((attributes == INVALID_FILE_ATTRIBUTES) ||
715 ((attributes & FILE_ATTRIBUTE_REPARSE_POINT) == 0)) {
719 if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
731 const auto path = ToWinAPIFilePath(
name);
732 return DeleteLinkHelper(
path.get());
736 const char* old_name,
737 const char* new_name) {
738 const auto old_path = ToWinAPIFilePath(old_name);
740 if (
type != expected) {
744 const auto new_path = ToWinAPIFilePath(new_name);
745 DWORD flags = MOVEFILE_WRITE_THROUGH | MOVEFILE_REPLACE_EXISTING;
755 if (!DeleteLinkHelper(new_path.get())) {
759 int move_status = MoveFileExW(old_path.get(), new_path.get(),
flags);
760 return (move_status != 0);
764 const char* old_name,
765 const char* new_name) {
770 const char* old_name,
771 const char* new_name) {
775static std::unique_ptr<wchar_t[]> GetDirectoryPath(
776 const std::unique_ptr<
wchar_t[]>&
path) {
777 for (intptr_t
i = wcslen(
path.get()) - 1;
i >= 0; --
i) {
778 if (
path.get()[
i] ==
'\\' ||
path.get()[
i] ==
'/') {
781 auto result = std::make_unique<wchar_t[]>(
i + 2);
789static void FreeUUID(
wchar_t* ptr) {
790 RpcStringFreeW(&ptr);
793static std::unique_ptr<wchar_t,
decltype(FreeUUID)*> GenerateUUIDString() {
795 RPC_STATUS status = UuidCreateSequential(&uuid);
796 if ((status != RPC_S_OK) && (status != RPC_S_UUID_LOCAL_ONLY)) {
797 return {
nullptr,
nullptr};
799 wchar_t* uuid_string;
800 status = UuidToStringW(&uuid, &uuid_string);
801 if (status != RPC_S_OK) {
802 return {
nullptr,
nullptr};
805 return {uuid_string, &FreeUUID};
810static std::unique_ptr<wchar_t[]> CopyIntoTempFile(
811 const std::unique_ptr<
wchar_t[]>&
src,
812 const std::unique_ptr<
wchar_t[]>&
dest) {
813 const auto dir = GetDirectoryPath(
dest);
814 if (
dir ==
nullptr) {
818 uint32_t suffix_bytes = 0;
819 const int kSuffixSize =
sizeof(suffix_bytes);
821 reinterpret_cast<uint8_t*
>(&suffix_bytes))) {
822 const size_t file_path_buf_size = wcslen(
dir.get()) + 8 + 1;
823 auto file_path = std::make_unique<wchar_t[]>(file_path_buf_size);
824 swprintf(file_path.get(), file_path_buf_size,
L"%s%x",
dir.get(),
827 if (CopyFileExW(
src.get(), file_path.get(),
nullptr,
nullptr,
nullptr, 0) !=
836 const auto uuid_str = GenerateUUIDString();
837 if (uuid_str ==
nullptr) {
841 const size_t file_path_buf_size =
842 wcslen(
dir.get()) + wcslen(uuid_str.get()) + 1;
843 auto file_path = std::make_unique<wchar_t[]>(file_path_buf_size);
844 swprintf(file_path.get(), file_path_buf_size,
L"%s%s",
dir.get(),
847 if (CopyFileExW(
src.get(), file_path.get(),
nullptr,
nullptr,
nullptr, 0) !=
856 const char* old_name,
857 const char* new_name) {
860 const auto old_path = ToWinAPIFilePath(old_name);
861 const auto new_path = ToWinAPIFilePath(new_name,
true);
869 const auto temp_file = CopyIntoTempFile(old_path, new_path);
870 if (temp_file ==
nullptr) {
872 return CopyFileExW(old_path.get(), new_path.get(),
nullptr,
nullptr,
878 DeleteFileW(new_path.get());
881 if (!MoveFileW(temp_file.get(), new_path.get())) {
883 DeleteFileW(temp_file.get());
893 const auto path = ToWinAPIFilePath(
name);
894 if (!StatHelper(
path.get(), &st)) {
901 const char* pathname,
904 const auto path = ToWinAPIFilePath(pathname);
905 HANDLE dir_handle = CreateFileW(
906 path.get(), GENERIC_READ,
907 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
nullptr,
908 OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
917 sizeof(REPARSE_DATA_BUFFER) + (
MAX_PATH + 1) *
sizeof(WCHAR);
918 REPARSE_DATA_BUFFER*
buffer =
920 DWORD received_bytes;
921 int result = DeviceIoControl(dir_handle, FSCTL_GET_REPARSE_POINT,
nullptr, 0,
927 if (
error == ERROR_MORE_DATA) {
930 sizeof(REPARSE_DATA_BUFFER) + (
MAX_LONG_PATH + 1) *
sizeof(WCHAR);
931 buffer =
reinterpret_cast<REPARSE_DATA_BUFFER*
>(
933 result = DeviceIoControl(dir_handle, FSCTL_GET_REPARSE_POINT,
nullptr, 0,
941 CloseHandle(dir_handle);
946 if (CloseHandle(dir_handle) == 0) {
951 size_t target_offset;
952 size_t target_length;
953 if (
buffer->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) {
955 target_offset =
buffer->MountPointReparseBuffer.SubstituteNameOffset;
956 target_length =
buffer->MountPointReparseBuffer.SubstituteNameLength;
957 }
else if (
buffer->ReparseTag == IO_REPARSE_TAG_SYMLINK) {
959 target_offset =
buffer->SymbolicLinkReparseBuffer.SubstituteNameOffset;
960 target_length =
buffer->SymbolicLinkReparseBuffer.SubstituteNameLength;
966 target_offset /=
sizeof(wchar_t);
967 target_length /=
sizeof(wchar_t);
970 if ((target_length > 4) && (wcsncmp(
L"\\??\\",
target, 4) == 0)) {
974 int utf8_length = WideCharToMultiByte(CP_UTF8, 0,
target, target_length,
975 nullptr, 0,
nullptr,
nullptr);
976 if (dest_size > 0 && dest_size <= utf8_length) {
979 if (
dest ==
nullptr) {
982 if (0 == WideCharToMultiByte(CP_UTF8, 0,
target, target_length,
dest,
983 utf8_length,
nullptr,
nullptr)) {
986 dest[utf8_length] =
'\0';
991 const auto path = ToWinAPIFilePath(
name);
996 int stat_status = _wstat64(
path.get(), &st);
997 if (stat_status == 0) {
1011 const auto path = ToWinAPIFilePath(
name);
1012 if (!StatHelper(
path.get(), &st)) {
1020 const auto path = ToWinAPIFilePath(
name);
1021 if (!StatHelper(
path.get(), &st)) {
1031 const auto path = ToWinAPIFilePath(
name);
1032 if (!StatHelper(
path.get(), &st)) {
1044 CreateFileW(
path.get(), FILE_WRITE_ATTRIBUTES,
1045 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
1046 nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS,
nullptr);
1050 bool result = SetFileTime(file_handle,
nullptr, &at,
nullptr);
1051 CloseHandle(file_handle);
1060 const auto path = ToWinAPIFilePath(
name);
1061 if (!StatHelper(
path.get(), &st)) {
1066 struct __utimbuf64
times;
1067 times.actime = st.st_atime;
1069 return _wutime64(
path.get(), &
times) == 0;
1075 if (pathname ==
nullptr)
return false;
1076 char first = pathname[0];
1077 char second = pathname[1];
1078 if (first ==
'\\' && second ==
'\\')
return true;
1079 if (second !=
':')
return false;
1081 char third = pathname[2];
1082 return (first >=
'a') && (first <=
'z') && (third ==
'\\' || third ==
'/');
1086 const char* pathname,
1089 const auto path = ToWinAPIFilePath(pathname);
1091 CreateFileW(
path.get(), 0, FILE_SHARE_READ,
nullptr, OPEN_EXISTING,
1092 FILE_FLAG_BACKUP_SEMANTICS,
nullptr);
1096 wchar_t dummy_buffer[1];
1098 GetFinalPathNameByHandle(file_handle, dummy_buffer, 0, VOLUME_NAME_DOS);
1099 if (required_size == 0) {
1101 CloseHandle(file_handle);
1106 const auto canonical_path = std::make_unique<wchar_t[]>(required_size);
1107 int result_size = GetFinalPathNameByHandle(file_handle, canonical_path.get(),
1108 required_size, VOLUME_NAME_DOS);
1109 ASSERT(result_size <= required_size - 1);
1110 CloseHandle(file_handle);
1115 if ((result_size > 4) &&
1116 (wcsncmp(canonical_path.get(),
L"\\\\?\\", 4) == 0) &&
1117 (strncmp(pathname,
"\\\\?\\", 4) != 0)) {
1118 if ((result_size > 8) &&
1119 (wcsncmp(canonical_path.get(),
L"\\\\?\\UNC\\", 8) == 0)) {
1125 int utf8_size = WideCharToMultiByte(CP_UTF8, 0, canonical_path.get() +
offset,
1126 -1,
nullptr, 0,
nullptr,
nullptr);
1127 if (
dest ==
nullptr) {
1129 dest_size = utf8_size;
1131 if (dest_size != 0) {
1132 ASSERT(utf8_size <= dest_size);
1134 if (0 == WideCharToMultiByte(CP_UTF8, 0, canonical_path.get() +
offset, -1,
1135 dest, dest_size,
nullptr,
nullptr)) {
1158 DWORD attributes = GetFileAttributesW(
path);
1159 if (attributes == INVALID_FILE_ATTRIBUTES) {
1161 }
else if ((attributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0) {
1163 HANDLE target_handle = CreateFileW(
1164 path, 0, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
1165 nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS,
nullptr);
1169 BY_HANDLE_FILE_INFORMATION
info;
1170 if (!GetFileInformationByHandle(target_handle, &
info)) {
1171 CloseHandle(target_handle);
1174 CloseHandle(target_handle);
1175 return ((
info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
1182 }
else if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
1190 bool follow_links) {
1191 const auto path = ToWinAPIFilePath(
name);
1197 Namespace* namespc_2,
1198 const char* file_2) {
1201 BY_HANDLE_FILE_INFORMATION file_info[2];
1202 const std::unique_ptr<wchar_t[]> file_names[2] = {ToWinAPIFilePath(file_1),
1203 ToWinAPIFilePath(file_2)};
1204 for (
int i = 0;
i < 2; ++
i) {
1205 HANDLE file_handle = CreateFileW(
1206 file_names[
i].
get(), 0,
1207 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
nullptr,
1209 FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
nullptr);
1213 int result = GetFileInformationByHandle(file_handle, &file_info[
i]);
1216 CloseHandle(file_handle);
1220 if (CloseHandle(file_handle) == 0) {
1224 if ((file_info[0].dwVolumeSerialNumber ==
1225 file_info[1].dwVolumeSerialNumber) &&
1226 (file_info[0].nFileIndexHigh == file_info[1].nFileIndexHigh) &&
1227 (file_info[0].nFileIndexLow == file_info[1].nFileIndexLow)) {
static SkISize times(const SkISize &size, float factor)
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
static uint32_t buffer_size(uint32_t offset, uint32_t maxAlignment)
static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
static int32_t Low32Bits(int64_t value)
static char * StrDup(const char *s)
static int32_t High32Bits(int64_t value)
static T Minimum(T x, T y)
static size_t Read(int filedes, void *buf, size_t nbyte)
static int Close(int fildes)
static bool GetRandomBytes(intptr_t count, uint8_t *buffer)
static char * ScopedCString(intptr_t length)
static ExistsResult Exists(Namespace *namespc, const char *path)
FileHandle(HANDLE handle)
static bool CreatePipe(Namespace *namespc, File **readPipe, File **writePipe)
static bool DeleteLink(Namespace *namespc, const char *path)
static bool IsAbsolutePath(const char *path)
MappedMemory * Map(MapType type, int64_t position, int64_t length, void *start=nullptr)
static const char * GetCanonicalPath(Namespace *namespc, const char *path, char *dest=nullptr, int dest_size=0)
static CStringUniquePtr UriToPath(const char *uri)
int64_t Read(void *buffer, int64_t num_bytes)
static bool SetLastAccessed(Namespace *namespc, const char *path, int64_t millis)
static File * OpenUri(Namespace *namespc, const char *uri, FileOpenMode mode)
static bool SetLastModified(Namespace *namespc, const char *path, int64_t millis)
static time_t LastModified(Namespace *namespc, const char *path)
static void Stat(Namespace *namespc, const char *path, int64_t *data)
static const char * PathSeparator()
static bool Create(Namespace *namespc, const char *path, bool exclusive)
bool VPrint(const char *format, va_list args)
static bool Rename(Namespace *namespc, const char *old_path, const char *new_path)
static bool Delete(Namespace *namespc, const char *path)
static const char * StringEscapedPathSeparator()
bool WriteFully(const void *buffer, int64_t num_bytes)
static int64_t LengthFromPath(Namespace *namespc, const char *path)
bool ReadFully(void *buffer, int64_t num_bytes)
static bool Copy(Namespace *namespc, const char *old_path, const char *new_path)
static time_t LastAccessed(Namespace *namespc, const char *path)
int64_t Write(const void *buffer, int64_t num_bytes)
static bool Exists(Namespace *namespc, const char *path)
static File * Open(Namespace *namespc, const char *path, FileOpenMode mode)
bool Lock(LockType lock, int64_t start, int64_t end)
bool SetPosition(int64_t position)
static Identical AreIdentical(Namespace *namespc_1, const char *file_1, Namespace *namespc_2, const char *file_2)
static File * OpenFD(int fd)
static const char * LinkTarget(Namespace *namespc, const char *pathname, char *dest=nullptr, int dest_size=0)
static bool CreateLink(Namespace *namespc, const char *path, const char *target)
static bool ExistsUri(Namespace *namespc, const char *uri)
static File * OpenStdio(int fd)
static StdioHandleType GetStdioHandleType(int fd)
static Type GetType(Namespace *namespc, const char *path, bool follow_links)
bool Truncate(int64_t length)
static bool RenameLink(Namespace *namespc, const char *old_path, const char *new_path)
#define MAX_DIRECTORY_PATH
FlutterSemanticsFlag flags
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
const uint8_t uint32_t uint32_t GError ** error
uint32_t uint32_t * format
void WriteFile(const void *buffer, intptr_t num_bytes, void *stream)
std::unique_ptr< wchar_t[]> Utf8ToWideChar(const char *path)
FILETIME GetFiletimeFromMillis(int64_t millis)
std::unique_ptr< wchar_t[]> ToWinAPIDirectoryPath(const char *path, bool force_long_prefix=false)
constexpr int64_t kMaxInt64
CAllocUniquePtr< char > CStringUniquePtr
void * malloc(size_t size)
DART_EXPORT uint8_t * Dart_ScopeAllocate(intptr_t size)
constexpr intptr_t kMillisecondsPerSecond
static int8_t data[kExtLength]
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 Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
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
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
static bool IsAbsolutePath(const char *path)
bool FileExists(const fml::UniqueFD &base_directory, const char *path)
const myers::Point & get(const myers::Segment &)
#define INVALID_HANDLE_VALUE
WINBASEAPI VOID WINAPI SetLastError(_In_ DWORD dwErrCode)
struct _FILETIME FILETIME
WINBASEAPI _Check_return_ _Post_equals_last_error_ DWORD WINAPI GetLastError(VOID)
struct _OVERLAPPED OVERLAPPED
#define ERROR_FILE_NOT_FOUND
#define ERROR_ACCESS_DENIED