OLD | NEW |
1 // Copyright (c) 2011, 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('minfrogc'); | 5 #library('minfrogc'); |
6 | 6 |
| 7 #import('dart:io'); |
7 #import('file_system_vm.dart'); | 8 #import('file_system_vm.dart'); |
8 #import('lang.dart'); | 9 #import('lang.dart'); |
9 | 10 |
10 main() { | 11 main() { |
11 List<String> argv = (new Options()).arguments; | 12 List<String> argv = (new Options()).arguments; |
12 | 13 |
13 // Infer --out if there is none defined. | 14 // Infer --out if there is none defined. |
14 var outFileDefined = false; | 15 var outFileDefined = false; |
15 for (var arg in argv) { | 16 for (var arg in argv) { |
16 if (arg.startsWith('--out=')) outFileDefined = true; | 17 if (arg.startsWith('--out=')) outFileDefined = true; |
17 } | 18 } |
18 | 19 |
19 if (!outFileDefined) { | 20 if (!outFileDefined) { |
20 argv.insertRange(0, 1, "--out=" + argv[argv.length-1] + ".js"); | 21 argv.insertRange(0, 1, "--out=" + argv[argv.length-1] + ".js"); |
21 } | 22 } |
22 | 23 |
23 // TODO(dgrove) we're simulating node by placing the arguments to frogc | 24 // TODO(dgrove) we're simulating node by placing the arguments to frogc |
24 // starting at index 2. | 25 // starting at index 2. |
25 argv.insertRange(0, 2, null); | 26 argv.insertRange(0, 2, null); |
26 | 27 |
27 // TODO(dgrove) Until we have a way of getting the executable's path, we'll | 28 // TODO(dgrove) Until we have a way of getting the executable's path, we'll |
28 // run from '.' | 29 // run from '.' |
29 var homedir = (new File('.')).fullPathSync(); | 30 var homedir = (new File('.')).fullPathSync(); |
30 | 31 |
31 if (!compile(homedir, argv, new VMFileSystem())) { | 32 if (!compile(homedir, argv, new VMFileSystem())) { |
32 print("Compilation failed"); | 33 print("Compilation failed"); |
33 exit(1); | 34 exit(1); |
34 } | 35 } |
35 } | 36 } |
OLD | NEW |