Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
dart::bin::PathSanitizer Class Reference

#include <dfe.h>

Public Member Functions

 PathSanitizer (const char *path)
 
const char * sanitized_uri () const
 

Detailed Description

Definition at line 194 of file dfe.h.

Constructor & Destructor Documentation

◆ PathSanitizer()

dart::bin::PathSanitizer::PathSanitizer ( const char *  path)
explicit

Definition at line 148 of file dfe.cc.

148 {
149#if defined(DART_HOST_OS_WINDOWS)
150 // For Windows we need to massage the paths a bit according to
151 // http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx
152 //
153 // Convert
154 // C:\one\two\three
155 // to
156 // /C:/one/two/three
157 //
158 // (see builtin.dart#_sanitizeWindowsPath)
159 if (path == nullptr) {
160 return;
161 }
162 intptr_t len = strlen(path);
163 char* uri = reinterpret_cast<char*>(new char[len + 1 + 1]);
164 if (uri == nullptr) {
166 }
167 char* s = uri;
168 if (len > 2 && path[1] == ':') {
169 *s++ = '/';
170 }
171 for (const char* p = path; *p != '\0'; ++p, ++s) {
172 *s = *p == '\\' ? '/' : *p;
173 }
174 *s = '\0';
175 sanitized_uri_ = std::unique_ptr<char[]>(uri);
176#else
177 sanitized_uri_ = path;
178#endif // defined(DART_HOST_OS_WINDOWS)
179}
#define OUT_OF_MEMORY()
Definition: assert.h:250
struct MyStruct s
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

Member Function Documentation

◆ sanitized_uri()

const char * dart::bin::PathSanitizer::sanitized_uri ( ) const

Definition at line 181 of file dfe.cc.

181 {
182#if defined(DART_HOST_OS_WINDOWS)
183 return sanitized_uri_.get();
184#else
185 return sanitized_uri_;
186#endif // defined(DART_HOST_OS_WINDOWS)
187}

The documentation for this class was generated from the following files: