Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
file_loader_win.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 <iostream>
8#include <memory>
9#include <utility>
10
11#include "tonic/common/macros.h"
15
16namespace tonic {
17namespace {
18
19void FindAndReplaceInPlace(std::string& str,
20 const std::string& findStr,
21 const std::string& replaceStr) {
22 size_t pos = 0;
23 while ((pos = str.find(findStr, pos)) != std::string::npos) {
24 str.replace(pos, findStr.length(), replaceStr);
25 pos += replaceStr.length();
26 }
27}
28
29} // namespace
30
31const char FileLoader::kFileURLPrefix[] = "file:///";
34const std::string FileLoader::kPathSeparator = "\\";
35
36std::string FileLoader::SanitizePath(const std::string& url) {
37 std::string sanitized = url;
38 FindAndReplaceInPlace(sanitized, "/", FileLoader::kPathSeparator);
39 return SanitizeURIEscapedCharacters(sanitized);
40}
41
42bool FileLoader::ReadFileToString(const std::string& path,
43 std::string* result) {
44 TONIC_DCHECK(dirfd_ == -1);
46}
47
48std::pair<uint8_t*, intptr_t> FileLoader::ReadFileToBytes(
49 const std::string& path) {
50 TONIC_DCHECK(dirfd_ == -1);
51 return filesystem::ReadFileToBytes(path);
52}
53
54} // namespace tonic
SkPoint pos
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 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
float length() const
#define TONIC_DCHECK
Definition macros.h:32