| 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('dart2js'); | 5 #library('dart2js'); |
| 6 | 6 |
| 7 #import('dart:io'); | 7 #import('dart:io'); |
| 8 #import('dart:uri'); | 8 #import('dart:uri'); |
| 9 #import('dart:utf'); | 9 #import('dart:utf'); |
| 10 | 10 |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 file.closeSync(); | 131 file.closeSync(); |
| 132 return new String.fromCharCodes(new Utf8Decoder(buffer).decodeRest()); | 132 return new String.fromCharCodes(new Utf8Decoder(buffer).decodeRest()); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void fail(String message) { | 135 void fail(String message) { |
| 136 print(message); | 136 print(message); |
| 137 exit(1); | 137 exit(1); |
| 138 } | 138 } |
| 139 | 139 |
| 140 void compilerMain(Options options) { | 140 void compilerMain(Options options) { |
| 141 List<String> argv = ['--library-root=${options.script}/$LIBRARY_ROOT']; | 141 var root = uriPathToNative("/$LIBRARY_ROOT"); |
| 142 List<String> argv = ['--library-root=${options.script}$root']; |
| 142 argv.addAll(options.arguments); | 143 argv.addAll(options.arguments); |
| 143 compile(argv); | 144 compile(argv); |
| 144 } | 145 } |
| 145 | 146 |
| 146 void main() { | 147 void main() { |
| 147 try { | 148 try { |
| 148 compilerMain(new Options()); | 149 compilerMain(new Options()); |
| 149 } catch (var exception, var trace) { | 150 } catch (var exception, var trace) { |
| 150 try { | 151 try { |
| 151 print('Internal error: $exception'); | 152 print('Internal error: $exception'); |
| 152 } catch (var ignored) { | 153 } catch (var ignored) { |
| 153 print('Internal error: error while printing exception'); | 154 print('Internal error: error while printing exception'); |
| 154 } | 155 } |
| 155 try { | 156 try { |
| 156 print(trace); | 157 print(trace); |
| 157 } finally { | 158 } finally { |
| 158 exit(253); // 253 is recognized as a crash by our test scripts. | 159 exit(253); // 253 is recognized as a crash by our test scripts. |
| 159 } | 160 } |
| 160 } | 161 } |
| 161 } | 162 } |
| OLD | NEW |