Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
file_loader_fuchsia.cc
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
6
7#include <dirent.h>
8#include <fcntl.h>
9#include <sys/types.h>
10
11#include <cerrno>
12#include <iostream>
13#include <memory>
14#include <utility>
15
16#include "tonic/common/macros.h"
21
22namespace tonic {
23
24const std::string FileLoader::kPathSeparator = "/";
25const char FileLoader::kFileURLPrefix[] = "file://";
28
29std::string FileLoader::SanitizePath(const std::string& url) {
30 return SanitizeURIEscapedCharacters(url);
31}
32
33bool FileLoader::ReadFileToString(const std::string& path,
34 std::string* result) {
35 if (dirfd_ == -1)
37 const char* cpath = path.c_str();
38 const int offset = (cpath[0] == '/') ? 1 : 0;
39 filesystem::Descriptor fd(openat(dirfd_, &cpath[offset], O_RDONLY));
41}
42
43std::pair<uint8_t*, intptr_t> FileLoader::ReadFileToBytes(
44 const std::string& path) {
45 if (dirfd_ == -1)
46 return filesystem::ReadFileToBytes(path);
47 const char* cpath = path.c_str();
48 const int offset = (cpath[0] == '/') ? 1 : 0;
49 filesystem::Descriptor fd(openat(dirfd_, &cpath[offset], O_RDONLY));
51}
52
53} // namespace tonic
static const char kFileURLPrefix[]
Definition file_loader.h:42
static const size_t kFileURLPrefixLength
Definition file_loader.h:43
static const std::string kPathSeparator
Definition file_loader.h:44
GAsyncResult * result
bool ReadFileDescriptorToString(int fd, std::string *result)
Definition file.cc:90
bool ReadFileToString(const std::string &path, std::string *result)
Definition file.cc:85
std::pair< uint8_t *, intptr_t > ReadFileToBytes(const std::string &path)
Definition file.cc:94
std::pair< uint8_t *, intptr_t > ReadFileDescriptorToBytes(int fd)
Definition file.cc:63
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
Definition switches.h:57
Point offset