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 solveserved. 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'; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 // Remember the root script URI so that we can resolve packages based on | 254 // Remember the root script URI so that we can resolve packages based on |
255 // this location. | 255 // this location. |
256 _rootScript = scriptUri; | 256 _rootScript = scriptUri; |
257 | 257 |
258 if (_traceLoading) { | 258 if (_traceLoading) { |
259 _log('Resolved entry point to: $_rootScript'); | 259 _log('Resolved entry point to: $_rootScript'); |
260 } | 260 } |
261 return scriptUri.toString(); | 261 return scriptUri.toString(); |
262 } | 262 } |
263 | 263 |
264 // Embedder Entrypoint: | |
265 // Function called by standalone embedder to resolve uris when the VM requests | |
266 // Dart_kCanonicalizeUrl from the tag handler. | |
267 String _resolveUri(String base, String userString) { | |
268 if (!_setupCompleted) { | |
269 _setupHooks(); | |
270 } | |
271 | |
272 if (_traceLoading) { | |
273 _log('Resolving: $userString from $base'); | |
274 } | |
275 | |
276 var baseUri = Uri.parse(base); | |
277 var result = baseUri.resolve(userString).toString(); | |
278 if (_traceLoading) { | |
279 _log('Resolved $userString in $base to $result'); | |
280 } | |
281 | |
282 return result; | |
283 } | |
284 | |
285 // Embedder Entrypoint (gen_snapshot): | 264 // Embedder Entrypoint (gen_snapshot): |
286 // Resolve relative paths relative to working directory. | 265 // Resolve relative paths relative to working directory. |
287 String _resolveInWorkingDirectory(String fileName) { | 266 String _resolveInWorkingDirectory(String fileName) { |
288 if (!_setupCompleted) { | 267 if (!_setupCompleted) { |
289 _setupHooks(); | 268 _setupHooks(); |
290 } | 269 } |
291 if (_workingDirectory == null) { | 270 if (_workingDirectory == null) { |
292 throw 'No current working directory set.'; | 271 throw 'No current working directory set.'; |
293 } | 272 } |
294 var name = _sanitizeWindowsPath(fileName); | 273 var name = _sanitizeWindowsPath(fileName); |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 if (_traceLoading) { | 386 if (_traceLoading) { |
408 _log("Exception when resolving package URI: $packageUri"); | 387 _log("Exception when resolving package URI: $packageUri"); |
409 } | 388 } |
410 result = null; | 389 result = null; |
411 } | 390 } |
412 if (_traceLoading) { | 391 if (_traceLoading) { |
413 _log("Resolved '$packageUri' to '$result'"); | 392 _log("Resolved '$packageUri' to '$result'"); |
414 } | 393 } |
415 return result; | 394 return result; |
416 } | 395 } |
OLD | NEW |