| Index: options.dart
|
| ===================================================================
|
| --- options.dart (revision 1140)
|
| +++ options.dart (working copy)
|
| @@ -6,9 +6,9 @@
|
| Options options;
|
|
|
| /** Extracts options from command-line arguments. */
|
| -void parseOptions(String homedir, List<String> args) {
|
| +void parseOptions(String homedir, List<String> args, FileSystem files) {
|
| assert(options == null);
|
| - options = new Options(homedir, args);
|
| + options = new Options(homedir, args, files);
|
| }
|
|
|
| // TODO(sigmund): make into a generic option parser...
|
| @@ -44,9 +44,11 @@
|
| */
|
| List<String> childArgs;
|
|
|
| - Options(String homedir, List<String> args) {
|
| + Options(String homedir, List<String> args, FileSystem files) {
|
| libDir = homedir + '/lib'; // Default value for --libdir.
|
| bool ignoreUnrecognizedFlags = false;
|
| + bool passedLibDir = false;
|
| + childArgs = [];
|
|
|
| // Start from 2 to skip arguments representing the compiler command
|
| // (node/python followed by frogsh/frog.py).
|
| @@ -106,11 +108,12 @@
|
| if (arg.endsWith('.dart')) {
|
| dartScript = arg;
|
| childArgs = args.getRange(i + 1, args.length - i - 1);
|
| - return;
|
| + break loop;
|
| } else if (arg.startsWith('--out=')) {
|
| outfile = arg.substring('--out='.length);
|
| } else if (arg.startsWith('--libdir=')) {
|
| libDir = arg.substring('--libdir='.length);
|
| + passedLibDir = true;
|
| } else {
|
| if (!ignoreUnrecognizedFlags) {
|
| print('unrecognized flag: "$arg"');
|
| @@ -118,6 +121,15 @@
|
| }
|
| }
|
| }
|
| - childArgs = [];
|
| +
|
| + if (!passedLibDir && !files.fileExists(libDir)) {
|
| + // Try locally
|
| + var temp = 'frog/lib';
|
| + if (files.fileExists(temp)) {
|
| + libDir = temp;
|
| + } else {
|
| + libDir = 'lib';
|
| + }
|
| + }
|
| }
|
| }
|
|
|