| 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 #import("dart:uri"); | |
| 7 | 6 |
| 8 void print(arg) { | 7 void print(arg) { |
| 9 _Logger._printString(arg.toString()); | 8 _Logger._printString(arg.toString()); |
| 10 } | 9 } |
| 11 | 10 |
| 12 void exit(int status) { | 11 void exit(int status) { |
| 13 if (status is !int) { | 12 if (status is !int) { |
| 14 throw new IllegalArgumentException("int status expected"); | 13 throw new IllegalArgumentException("int status expected"); |
| 15 } | 14 } |
| 16 _exit(status); | 15 _exit(status); |
| 17 } | 16 } |
| 18 | 17 |
| 19 _exit(int status) native "Exit"; | 18 _exit(int status) native "Exit"; |
| 20 | 19 |
| 21 class _Logger { | 20 class _Logger { |
| 22 static void _printString(String s) native "Logger_PrintString"; | 21 static void _printString(String s) native "Logger_PrintString"; |
| 23 } | 22 } |
| 24 | 23 |
| 25 | 24 |
| 26 // Code to deal with URI resolution for the standalone binary. | 25 // Code to deal with URI resolution for the standalone binary. |
| 27 // For Windows we need to massage the paths a bit according to | 26 // For Windows we need to massage the paths a bit according to |
| 28 // http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx | 27 // http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx |
| 29 var _is_windows; | 28 var _is_windows; |
| 30 | 29 |
| 31 // The URI that the entrypoint script was loaded from. Remembered so that | 30 // The URI that the entrypoint script was loaded from. Remembered so that |
| 32 // package imports can be resolved relative to it. | 31 // package imports can be resolved relative to it. |
| 33 Uri _entrypoint; | 32 var _entrypoint; |
| 34 | 33 |
| 35 // The directory to look in to resolve "package:" scheme URIs. | 34 // The directory to look in to resolve "package:" scheme URIs. |
| 36 String _packageRoot; | 35 var _packageRoot; |
| 37 | 36 |
| 38 void _logResolution(String msg) { | 37 void _logResolution(String msg) { |
| 39 final enabled = false; | 38 final enabled = false; |
| 40 if (enabled) { | 39 if (enabled) { |
| 41 _Logger._printString(msg); | 40 _Logger._printString(msg); |
| 42 } | 41 } |
| 43 } | 42 } |
| 44 | 43 |
| 45 String _setPackageRoot(String packageRoot) { | 44 String _setPackageRoot(String packageRoot) { |
| 46 // TODO(mattsh) - refactor windows drive and path handling code | 45 // TODO(mattsh) - refactor windows drive and path handling code |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 var path; | 152 var path; |
| 154 if (_packageRoot !== null) { | 153 if (_packageRoot !== null) { |
| 155 path = "${_packageRoot}${uri.path}"; | 154 path = "${_packageRoot}${uri.path}"; |
| 156 } else { | 155 } else { |
| 157 path = _entrypoint.resolve('packages/${uri.path}').path; | 156 path = _entrypoint.resolve('packages/${uri.path}').path; |
| 158 } | 157 } |
| 159 | 158 |
| 160 _logResolution("# Package: $path"); | 159 _logResolution("# Package: $path"); |
| 161 return path; | 160 return path; |
| 162 } | 161 } |
| OLD | NEW |