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 #import('dart:io'); | 5 #import('dart:io'); |
6 #import('dart:uri'); | 6 #import('dart:uri'); |
7 | 7 |
8 main() { | 8 main() { |
9 List<String> arguments = new Options().arguments; | 9 List<String> arguments = new Options().arguments; |
10 Uri uri = new Uri(scheme: 'file', path: '${arguments[0]}/'); | 10 Uri uri = new Uri(scheme: 'file', path: '${arguments[0]}/'); |
(...skipping 13 matching lines...) Expand all Loading... |
24 writeScript(Uri uri, List<String> chunks) { | 24 writeScript(Uri uri, List<String> chunks) { |
25 var f = new File(uri.path); | 25 var f = new File(uri.path); |
26 var stream = f.openSync(FileMode.WRITE); | 26 var stream = f.openSync(FileMode.WRITE); |
27 for (String chunk in chunks) { | 27 for (String chunk in chunks) { |
28 stream.writeStringSync(chunk); | 28 stream.writeStringSync(chunk); |
29 } | 29 } |
30 stream.closeSync(); | 30 stream.closeSync(); |
31 | 31 |
32 // TODO(ahe): Also make a .bat file for Windows. | 32 // TODO(ahe): Also make a .bat file for Windows. |
33 | 33 |
34 if (new Platform().operatingSystem() != 'windows') { | 34 if (Platform.operatingSystem() != 'windows') { |
35 onExit(int exitCode, String stdout, String stderr) { | 35 onExit(int exitCode, String stdout, String stderr) { |
36 if (exitCode != 0) { | 36 if (exitCode != 0) { |
37 print(stdout); | 37 print(stdout); |
38 print(stderr); | 38 print(stderr); |
39 exit(exitCode); | 39 exit(exitCode); |
40 } | 40 } |
41 } | 41 } |
42 new Process.run('/bin/chmod', ['+x', uri.path], null, onExit); | 42 new Process.run('/bin/chmod', ['+x', uri.path], null, onExit); |
43 } | 43 } |
44 } | 44 } |
(...skipping 30 matching lines...) Expand all Loading... |
75 } | 75 } |
76 } | 76 } |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 void main() { | 80 void main() { |
81 new Helper().run(); | 81 new Helper().run(); |
82 } | 82 } |
83 """; | 83 """; |
84 } | 84 } |
OLD | NEW |