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);
133 bool result = VirtualProtect(addr,
length, prot_final, &old_prot);
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);
196 char*
buffer =
reinterpret_cast<char*
>(
malloc(len + 1));
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);
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;
298 if ((mode &
kWrite) != 0) {
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) {
353static bool IsAbsolutePath(
const wchar_t* pathname) {
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'/');
374static std::unique_ptr<wchar_t[]> ToWinAPIPath(
const char* utf8_path,
376 bool force_long_prefix) {
383 const wchar_t* kLongPathPrefix =
L"\\\\?\\";
384 const int kLongPathPrefixLength = 4;
386 std::unique_ptr<wchar_t[]> absolute_path;
387 if (!IsAbsolutePath(
path.get())) {
388 absolute_path = ConvertToAbsolutePath(path);
389 if (absolute_path ==
nullptr) {
393 absolute_path = std::move(path);
396 int path_length = wcslen(absolute_path.get());
398 if (!force_long_prefix && path_length < path_short_limit) {
399 if (path ==
nullptr) {
400 return absolute_path;
406 if (wcsncmp(absolute_path.get(), kLongPathPrefix, kLongPathPrefixLength) ==
408 return absolute_path;
413 std::make_unique<wchar_t[]>(kLongPathPrefixLength + path_length + 1);
414 wcsncpy(
result.get(), kLongPathPrefix, kLongPathPrefixLength);
415 for (
int i = 0; i < path_length; i++) {
416 result.get()[kLongPathPrefixLength + i] =
417 absolute_path[i] ==
L'/' ?
L'\\' : absolute_path[i];
419 result.get()[path_length + kLongPathPrefixLength] =
L'\0';
432static std::unique_ptr<wchar_t[]> ToWinAPIFilePath(
434 bool force_long_prefix =
false) {
435 return ToWinAPIPath(path,
true, force_long_prefix);
440 bool force_long_prefix ) {
441 return ToWinAPIPath(path,
false, force_long_prefix);
444File*
File::Open(Namespace* namespc,
const char*
name, FileOpenMode mode) {
445 const auto path = ToWinAPIFilePath(
name);
446 File*
file = FileOpenW(
path.get(), mode);
451 UriDecoder uri_decoder(uri);
452 if (uri_decoder.decoded() ==
nullptr) {
458 if (!UrlIsFileUrlW(uri_w.get())) {
463 HRESULT
result = PathCreateFromUrlW(uri_w.get(), filename_w, &filename_len,
469 WideToUtf8Scope utf8_path(filename_w);
470 return utf8_path.release();
473File*
File::OpenUri(Namespace* namespc,
const char* uri, FileOpenMode mode) {
475 if (path ==
nullptr) {
478 return Open(namespc,
path.get(), mode);
485 stdio_fd = _fileno(stdout);
488 stdio_fd = _fileno(stderr);
493 _setmode(stdio_fd, _O_BINARY);
494 return new File(
new FileHandle(stdio_fd));
497static bool StatHelper(
const wchar_t* path,
struct __stat64* st) {
498 int stat_status = _wstat64(path, st);
499 if (stat_status != 0) {
502 if ((st->st_mode & S_IFMT) != S_IFREG) {
511 return StatHelper(path, &st);
515 const auto path = ToWinAPIFilePath(
name);
520 UriDecoder uri_decoder(uri);
521 if (uri_decoder.decoded() ==
nullptr) {
529 const auto path = ToWinAPIFilePath(
name);
530 int flags = O_RDONLY | O_CREAT;
534 int fd = _wopen(
path.get(),
flags, 0666);
542typedef struct _REPARSE_DATA_BUFFER {
544 USHORT ReparseDataLength;
549 USHORT SubstituteNameOffset;
550 USHORT SubstituteNameLength;
551 USHORT PrintNameOffset;
552 USHORT PrintNameLength;
555 } SymbolicLinkReparseBuffer;
558 USHORT SubstituteNameOffset;
559 USHORT SubstituteNameLength;
560 USHORT PrintNameOffset;
561 USHORT PrintNameLength;
563 } MountPointReparseBuffer;
567 } GenericReparseBuffer;
569} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
572 const char* utf8_name,
573 const char* utf8_target) {
574 const auto name = ToWinAPIFilePath(utf8_name);
576 std::unique_ptr<wchar_t[]>
target;
577 bool target_is_directory;
579 target = ToWinAPIFilePath(utf8_target);
580 target_is_directory =
603 intptr_t target_path_max_length =
604 wcslen(
name.get()) + wcslen(
target.get()) + 2;
605 auto target_path = std::make_unique<wchar_t[]>(target_path_max_length);
606 wcscpy_s(target_path.get(), target_path_max_length,
name.get());
609 HRESULT remove_result =
610 PathCchRemoveFileSpec(target_path.get(), target_path_max_length);
611 if (remove_result == S_FALSE) {
617 }
else if (remove_result != S_OK) {
623 HRESULT combine_result = PathCchCombineEx(
624 target_path.get(), target_path_max_length, target_path.get(),
625 target.get(), PATHCCH_ALLOW_LONG_PATHS);
626 if (combine_result != S_OK) {
631 target_is_directory =
635 DWORD flags = SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE;
636 if (target_is_directory) {
637 flags |= SYMBOLIC_LINK_FLAG_DIRECTORY;
639 int create_status = CreateSymbolicLinkW(
name.get(),
target.get(),
flags);
644 if ((create_status == 0) && (
GetLastError() == ERROR_INVALID_PARAMETER)) {
645 flags &= ~SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE;
649 return (create_status != 0);
652bool File::CreatePipe(Namespace* namespc, File** readPipe, File** writePipe) {
654 int status = _pipe(pipe_fds, 4096, _O_BINARY);
658 *readPipe =
OpenFD(pipe_fds[0]);
659 *writePipe =
OpenFD(pipe_fds[1]);
664 const auto path = ToWinAPIFilePath(
name);
665 int status = _wremove(
path.get());
669static bool DeleteLinkHelper(
const wchar_t* path) {
671 DWORD attributes = GetFileAttributesW(path);
672 if ((attributes == INVALID_FILE_ATTRIBUTES) ||
673 ((attributes & FILE_ATTRIBUTE_REPARSE_POINT) == 0)) {
677 if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
680 result = (RemoveDirectoryW(path) != 0);
683 result = (DeleteFileW(path) != 0);
689 const auto path = ToWinAPIFilePath(
name);
690 return DeleteLinkHelper(
path.get());
694 const char* old_name,
695 const char* new_name) {
696 const auto old_path = ToWinAPIFilePath(old_name);
698 if (
type != expected) {
702 const auto new_path = ToWinAPIFilePath(new_name);
703 DWORD flags = MOVEFILE_WRITE_THROUGH | MOVEFILE_REPLACE_EXISTING;
713 if (!DeleteLinkHelper(new_path.get())) {
717 int move_status = MoveFileExW(old_path.get(), new_path.get(),
flags);
718 return (move_status != 0);
722 const char* old_name,
723 const char* new_name) {
728 const char* old_name,
729 const char* new_name) {
733static std::unique_ptr<wchar_t[]> GetDirectoryPath(
734 const std::unique_ptr<
wchar_t[]>& path) {
735 for (intptr_t i = wcslen(
path.get()) - 1; i >= 0; --i) {
736 if (
path.get()[i] ==
'\\' ||
path.get()[i] ==
'/') {
737 auto result = std::make_unique<wchar_t[]>(i + 1);
745static void FreeUUID(
wchar_t* ptr) {
746 RpcStringFreeW(&ptr);
749static std::unique_ptr<wchar_t,
decltype(FreeUUID)*> GenerateUUIDString() {
751 RPC_STATUS status = UuidCreateSequential(&uuid);
752 if ((status != RPC_S_OK) && (status != RPC_S_UUID_LOCAL_ONLY)) {
753 return {
nullptr,
nullptr};
755 wchar_t* uuid_string;
756 status = UuidToStringW(&uuid, &uuid_string);
757 if (status != RPC_S_OK) {
758 return {
nullptr,
nullptr};
761 return {uuid_string, &FreeUUID};
766static std::unique_ptr<wchar_t[]> CopyIntoTempFile(
767 const std::unique_ptr<
wchar_t[]>& src,
768 const std::unique_ptr<
wchar_t[]>& dest) {
769 const auto dir = GetDirectoryPath(dest);
770 if (dir ==
nullptr) {
774 uint32_t suffix_bytes = 0;
775 const int kSuffixSize =
sizeof(suffix_bytes);
777 reinterpret_cast<uint8_t*
>(&suffix_bytes))) {
778 const size_t file_path_buf_size = wcslen(
dir.get()) + 8 + 1;
779 auto file_path = std::make_unique<wchar_t[]>(file_path_buf_size);
780 swprintf(file_path.get(), file_path_buf_size,
L"%s%x",
dir.get(),
783 if (CopyFileExW(
src.get(), file_path.get(),
nullptr,
nullptr,
nullptr, 0) !=
792 const auto uuid_str = GenerateUUIDString();
793 if (uuid_str ==
nullptr) {
797 const size_t file_path_buf_size =
798 wcslen(
dir.get()) + wcslen(uuid_str.get()) + 1;
799 auto file_path = std::make_unique<wchar_t[]>(file_path_buf_size);
800 swprintf(file_path.get(), file_path_buf_size,
L"%s%s",
dir.get(),
803 if (CopyFileExW(
src.get(), file_path.get(),
nullptr,
nullptr,
nullptr, 0) !=
812 const char* old_name,
813 const char* new_name) {
816 const auto old_path = ToWinAPIFilePath(old_name,
true);
817 const auto new_path = ToWinAPIFilePath(new_name);
824 const auto temp_file = CopyIntoTempFile(old_path, new_path);
825 if (temp_file ==
nullptr) {
827 return CopyFileExW(old_path.get(), new_path.get(),
nullptr,
nullptr,
833 DeleteFileW(new_path.get());
836 if (!MoveFileW(temp_file.get(), new_path.get())) {
838 DeleteFileW(temp_file.get());
848 const auto path = ToWinAPIFilePath(
name);
849 if (!StatHelper(
path.get(), &st)) {
856 const char* pathname,
859 const auto path = ToWinAPIFilePath(pathname);
860 HANDLE dir_handle = CreateFileW(
861 path.get(), GENERIC_READ,
862 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
nullptr,
863 OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
872 sizeof(REPARSE_DATA_BUFFER) + (
MAX_PATH + 1) *
sizeof(WCHAR);
873 REPARSE_DATA_BUFFER*
buffer =
875 DWORD received_bytes;
876 int result = DeviceIoControl(dir_handle, FSCTL_GET_REPARSE_POINT,
nullptr, 0,
882 if (
error == ERROR_MORE_DATA) {
885 sizeof(REPARSE_DATA_BUFFER) + (
MAX_LONG_PATH + 1) *
sizeof(WCHAR);
886 buffer =
reinterpret_cast<REPARSE_DATA_BUFFER*
>(
888 result = DeviceIoControl(dir_handle, FSCTL_GET_REPARSE_POINT,
nullptr, 0,
896 CloseHandle(dir_handle);
901 if (CloseHandle(dir_handle) == 0) {
906 size_t target_offset;
907 size_t target_length;
908 if (
buffer->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) {
910 target_offset =
buffer->MountPointReparseBuffer.SubstituteNameOffset;
911 target_length =
buffer->MountPointReparseBuffer.SubstituteNameLength;
912 }
else if (
buffer->ReparseTag == IO_REPARSE_TAG_SYMLINK) {
914 target_offset =
buffer->SymbolicLinkReparseBuffer.SubstituteNameOffset;
915 target_length =
buffer->SymbolicLinkReparseBuffer.SubstituteNameLength;
921 target_offset /=
sizeof(wchar_t);
922 target_length /=
sizeof(wchar_t);
925 if ((target_length > 4) && (wcsncmp(
L"\\??\\",
target, 4) == 0)) {
929 int utf8_length = WideCharToMultiByte(CP_UTF8, 0,
target, target_length,
930 nullptr, 0,
nullptr,
nullptr);
931 if (dest_size > 0 && dest_size <= utf8_length) {
934 if (dest ==
nullptr) {
937 if (0 == WideCharToMultiByte(CP_UTF8, 0,
target, target_length, dest,
938 utf8_length,
nullptr,
nullptr)) {
941 dest[utf8_length] =
'\0';
946 const auto path = ToWinAPIFilePath(
name);
951 int stat_status = _wstat64(
path.get(), &st);
952 if (stat_status == 0) {
966 const auto path = ToWinAPIFilePath(
name);
967 if (!StatHelper(
path.get(), &st)) {
975 const auto path = ToWinAPIFilePath(
name);
976 if (!StatHelper(
path.get(), &st)) {
986 const auto path = ToWinAPIFilePath(
name);
987 if (!StatHelper(
path.get(), &st)) {
999 CreateFileW(
path.get(), FILE_WRITE_ATTRIBUTES,
1000 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
1001 nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS,
nullptr);
1005 bool result = SetFileTime(file_handle,
nullptr, &at,
nullptr);
1006 CloseHandle(file_handle);
1015 const auto path = ToWinAPIFilePath(
name);
1016 if (!StatHelper(
path.get(), &st)) {
1021 struct __utimbuf64
times;
1022 times.actime = st.st_atime;
1024 return _wutime64(
path.get(), &
times) == 0;
1030 if (pathname ==
nullptr)
return false;
1031 char first = pathname[0];
1032 char second = pathname[1];
1033 if (first ==
'\\' && second ==
'\\')
return true;
1034 if (second !=
':')
return false;
1036 char third = pathname[2];
1037 return (first >=
'a') && (first <=
'z') && (third ==
'\\' || third ==
'/');
1041 const char* pathname,
1044 const auto path = ToWinAPIFilePath(pathname);
1046 CreateFileW(
path.get(), 0, FILE_SHARE_READ,
nullptr, OPEN_EXISTING,
1047 FILE_FLAG_BACKUP_SEMANTICS,
nullptr);
1051 wchar_t dummy_buffer[1];
1053 GetFinalPathNameByHandle(file_handle, dummy_buffer, 0, VOLUME_NAME_DOS);
1054 if (required_size == 0) {
1056 CloseHandle(file_handle);
1061 const auto canonical_path = std::make_unique<wchar_t[]>(required_size);
1062 int result_size = GetFinalPathNameByHandle(file_handle, canonical_path.get(),
1063 required_size, VOLUME_NAME_DOS);
1064 ASSERT(result_size <= required_size - 1);
1065 CloseHandle(file_handle);
1070 if ((result_size > 4) &&
1071 (wcsncmp(canonical_path.get(),
L"\\\\?\\", 4) == 0) &&
1072 (strncmp(pathname,
"\\\\?\\", 4) != 0)) {
1073 if ((result_size > 8) &&
1074 (wcsncmp(canonical_path.get(),
L"\\\\?\\UNC\\", 8) == 0)) {
1080 int utf8_size = WideCharToMultiByte(CP_UTF8, 0, canonical_path.get() +
offset,
1081 -1,
nullptr, 0,
nullptr,
nullptr);
1082 if (dest ==
nullptr) {
1084 dest_size = utf8_size;
1086 if (dest_size != 0) {
1087 ASSERT(utf8_size <= dest_size);
1089 if (0 == WideCharToMultiByte(CP_UTF8, 0, canonical_path.get() +
offset, -1,
1090 dest, dest_size,
nullptr,
nullptr)) {
1113 DWORD attributes = GetFileAttributesW(path);
1114 if (attributes == INVALID_FILE_ATTRIBUTES) {
1116 }
else if ((attributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0) {
1118 HANDLE target_handle = CreateFileW(
1119 path, 0, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
1120 nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS,
nullptr);
1124 BY_HANDLE_FILE_INFORMATION
info;
1125 if (!GetFileInformationByHandle(target_handle, &
info)) {
1126 CloseHandle(target_handle);
1129 CloseHandle(target_handle);
1130 return ((
info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
1137 }
else if ((attributes & FILE_ATTRIBUTE_DIRECTORY) != 0) {
1145 bool follow_links) {
1146 const auto path = ToWinAPIFilePath(
name);
1152 Namespace* namespc_2,
1153 const char* file_2) {
1156 BY_HANDLE_FILE_INFORMATION file_info[2];
1157 const std::unique_ptr<wchar_t[]> file_names[2] = {ToWinAPIFilePath(file_1),
1158 ToWinAPIFilePath(file_2)};
1159 for (
int i = 0; i < 2; ++i) {
1160 HANDLE file_handle = CreateFileW(
1161 file_names[i].
get(), 0,
1162 FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
nullptr,
1164 FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT,
nullptr);
1168 int result = GetFileInformationByHandle(file_handle, &file_info[i]);
1171 CloseHandle(file_handle);
1175 if (CloseHandle(file_handle) == 0) {
1179 if ((file_info[0].dwVolumeSerialNumber ==
1180 file_info[1].dwVolumeSerialNumber) &&
1181 (file_info[0].nFileIndexHigh == file_info[1].nFileIndexHigh) &&
1182 (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 CStringUniquePtr CreateCStringUniquePtr(char *str)
static int32_t High32Bits(int64_t value)
static T Minimum(T x, T y)
std::unique_ptr< char, decltype(std::free) * > CStringUniquePtr
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)
int64_t Read(void *buffer, int64_t num_bytes)
static bool SetLastAccessed(Namespace *namespc, const char *path, int64_t millis)
static Utils::CStringUniquePtr UriToPath(const char *uri)
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
static const uint8_t buffer[]
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
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
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
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