| 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 reserved. 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 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 _log('Resolved in working directory: $fileName -> $uri'); | 815 _log('Resolved in working directory: $fileName -> $uri'); |
| 816 } | 816 } |
| 817 return uri.toString(); | 817 return uri.toString(); |
| 818 } | 818 } |
| 819 | 819 |
| 820 | 820 |
| 821 // Handling of dart-ext loading. | 821 // Handling of dart-ext loading. |
| 822 // Dart native extension scheme. | 822 // Dart native extension scheme. |
| 823 const _DART_EXT = 'dart-ext:'; | 823 const _DART_EXT = 'dart-ext:'; |
| 824 | 824 |
| 825 String _nativeLibraryExtension() native "Builtin_NativeLibraryExtension"; | |
| 826 | |
| 827 | |
| 828 String _platformExtensionFileName(String name) { | |
| 829 var extension = _nativeLibraryExtension(); | |
| 830 | |
| 831 if (_isWindows) { | |
| 832 return '$name.$extension'; | |
| 833 } else { | |
| 834 return 'lib$name.$extension'; | |
| 835 } | |
| 836 } | |
| 837 | |
| 838 | |
| 839 // Returns either a file path or a URI starting with http[s]:, as a String. | 825 // Returns either a file path or a URI starting with http[s]:, as a String. |
| 840 String _filePathFromUri(String userUri) { | 826 String _filePathFromUri(String userUri) { |
| 841 var uri = Uri.parse(userUri); | 827 var uri = Uri.parse(userUri); |
| 842 if (_traceLoading) { | 828 if (_traceLoading) { |
| 843 _log('Getting file path from: $uri'); | 829 _log('Getting file path from: $uri'); |
| 844 } | 830 } |
| 845 | 831 |
| 846 var path; | 832 var path; |
| 847 switch (uri.scheme) { | 833 switch (uri.scheme) { |
| 848 case '': | 834 case '': |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 int index = userUri.lastIndexOf('/'); | 877 int index = userUri.lastIndexOf('/'); |
| 892 if (index == -1) { | 878 if (index == -1) { |
| 893 name = userUri; | 879 name = userUri; |
| 894 path = './'; | 880 path = './'; |
| 895 } else if (index == userUri.length - 1) { | 881 } else if (index == userUri.length - 1) { |
| 896 throw 'Extension name missing in $extensionUri'; | 882 throw 'Extension name missing in $extensionUri'; |
| 897 } else { | 883 } else { |
| 898 name = userUri.substring(index + 1); | 884 name = userUri.substring(index + 1); |
| 899 path = userUri.substring(0, index + 1); | 885 path = userUri.substring(0, index + 1); |
| 900 } | 886 } |
| 887 path = _filePathFromUri(path); |
| 901 | 888 |
| 902 path = _filePathFromUri(path); | 889 return [path, name]; |
| 903 var filename = _platformExtensionFileName(name); | |
| 904 | |
| 905 return [path, filename, name]; | |
| 906 } | 890 } |
| 907 | 891 |
| 908 | 892 |
| 909 // Register callbacks and hooks with the rest of the core libraries. | 893 // Register callbacks and hooks with the rest of the core libraries. |
| 910 _setupHooks() { | 894 _setupHooks() { |
| 911 _setupCompleted = true; | 895 _setupCompleted = true; |
| 912 VMLibraryHooks.resourceReadAsBytes = _resourceReadAsBytes; | 896 VMLibraryHooks.resourceReadAsBytes = _resourceReadAsBytes; |
| 913 | 897 |
| 914 VMLibraryHooks.packageRootUriFuture = _getPackageRootFuture; | 898 VMLibraryHooks.packageRootUriFuture = _getPackageRootFuture; |
| 915 VMLibraryHooks.packageConfigUriFuture = _getPackageConfigFuture; | 899 VMLibraryHooks.packageConfigUriFuture = _getPackageConfigFuture; |
| 916 VMLibraryHooks.resolvePackageUriFuture = _resolvePackageUriFuture; | 900 VMLibraryHooks.resolvePackageUriFuture = _resolvePackageUriFuture; |
| 917 } | 901 } |
| OLD | NEW |