OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights solveserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library builtin; | 5 library builtin; |
6 // NOTE: Do not import 'dart:io' in builtin. | 6 // NOTE: Do not import 'dart:io' in builtin. |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 import 'dart:_internal'; | 9 import 'dart:_internal'; |
10 import 'dart:isolate'; | 10 import 'dart:isolate'; |
11 import 'dart:typed_data'; | 11 import 'dart:typed_data'; |
12 | 12 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 239 |
240 // Embedder Entrypoint: | 240 // Embedder Entrypoint: |
241 // The embedder calls this method with a custom package root. | 241 // The embedder calls this method with a custom package root. |
242 _setPackageRoot(String packageRoot) { | 242 _setPackageRoot(String packageRoot) { |
243 if (!_setupCompleted) { | 243 if (!_setupCompleted) { |
244 _setupHooks(); | 244 _setupHooks(); |
245 } | 245 } |
246 if (_traceLoading) { | 246 if (_traceLoading) { |
247 _log('Setting package root: $packageRoot'); | 247 _log('Setting package root: $packageRoot'); |
248 } | 248 } |
249 packageRoot = _enforceTrailingSlash(packageRoot); | |
250 if (packageRoot.startsWith('file:') || | 249 if (packageRoot.startsWith('file:') || |
251 packageRoot.startsWith('http:') || | 250 packageRoot.startsWith('http:') || |
252 packageRoot.startsWith('https:')) { | 251 packageRoot.startsWith('https:')) { |
| 252 packageRoot = _enforceTrailingSlash(packageRoot); |
253 _packageRoot = _workingDirectory.resolve(packageRoot); | 253 _packageRoot = _workingDirectory.resolve(packageRoot); |
254 } else { | 254 } else { |
255 packageRoot = _sanitizeWindowsPath(packageRoot); | 255 packageRoot = _sanitizeWindowsPath(packageRoot); |
256 packageRoot = _trimWindowsPath(packageRoot); | 256 packageRoot = _trimWindowsPath(packageRoot); |
257 _packageRoot = _workingDirectory.resolveUri(new Uri.file(packageRoot)); | 257 _packageRoot = _workingDirectory.resolveUri(new Uri.directory(packageRoot)); |
258 } | 258 } |
259 // Now that we have determined the packageRoot value being used, set it | 259 // Now that we have determined the packageRoot value being used, set it |
260 // up for use in Platform.packageRoot. This is only set when the embedder | 260 // up for use in Platform.packageRoot. This is only set when the embedder |
261 // sets up the package root. Automatically discovered package root will | 261 // sets up the package root. Automatically discovered package root will |
262 // not update the VMLibraryHooks value. | 262 // not update the VMLibraryHooks value. |
263 VMLibraryHooks.packageRootString = _packageRoot.toString(); | 263 VMLibraryHooks.packageRootString = _packageRoot.toString(); |
264 if (_traceLoading) { | 264 if (_traceLoading) { |
265 _log('Package root URI: $_packageRoot'); | 265 _log('Package root URI: $_packageRoot'); |
266 } | 266 } |
267 } | 267 } |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 | 876 |
877 // Register callbacks and hooks with the rest of the core libraries. | 877 // Register callbacks and hooks with the rest of the core libraries. |
878 _setupHooks() { | 878 _setupHooks() { |
879 _setupCompleted = true; | 879 _setupCompleted = true; |
880 VMLibraryHooks.resourceReadAsBytes = _resourceReadAsBytes; | 880 VMLibraryHooks.resourceReadAsBytes = _resourceReadAsBytes; |
881 | 881 |
882 VMLibraryHooks.packageRootUriFuture = _getPackageRootFuture; | 882 VMLibraryHooks.packageRootUriFuture = _getPackageRootFuture; |
883 VMLibraryHooks.packageConfigUriFuture = _getPackageConfigFuture; | 883 VMLibraryHooks.packageConfigUriFuture = _getPackageConfigFuture; |
884 VMLibraryHooks.resolvePackageUriFuture = _resolvePackageUriFuture; | 884 VMLibraryHooks.resolvePackageUriFuture = _resolvePackageUriFuture; |
885 } | 885 } |
OLD | NEW |