OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 options; | 5 library options; |
6 | 6 |
7 import 'package:args/args.dart'; | 7 import 'package:args/args.dart'; |
8 import 'package:path/path.dart'; | 8 import 'package:path/path.dart'; |
9 | 9 |
10 import 'dart:io'; | 10 import 'dart:io'; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 static _showUsage(parser) { | 169 static _showUsage(parser) { |
170 print('Usage: $_BINARY_NAME [options...] <libraries to analyze...>'); | 170 print('Usage: $_BINARY_NAME [options...] <libraries to analyze...>'); |
171 print(parser.getUsage()); | 171 print(parser.getUsage()); |
172 print(''); | 172 print(''); |
173 print('For more information, see http://www.dartlang.org/tools/analyzer.'); | 173 print('For more information, see http://www.dartlang.org/tools/analyzer.'); |
174 } | 174 } |
175 | 175 |
176 static String _getVersion() { | 176 static String _getVersion() { |
177 try { | 177 try { |
178 String versionPath = Platform.script.resolve('../version').toFilePath(); | 178 String versionPath = join(dirname(Platform.script), '..', 'version');; |
179 File versionFile = new File(versionPath); | 179 File versionFile = new File(versionPath); |
180 return versionFile.readAsStringSync().trim(); | 180 return versionFile.readAsStringSync().trim(); |
181 } catch (_) { | 181 } catch (_) { |
182 // This happens when the script is not running in the context of an SDK. | 182 // This happens when the script is not running in the context of an SDK. |
183 return "<unknown>"; | 183 return "<unknown>"; |
184 } | 184 } |
185 } | 185 } |
186 } | 186 } |
187 | 187 |
188 /** | 188 /** |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 | 277 |
278 _getNextFlagIndex(args, i) { | 278 _getNextFlagIndex(args, i) { |
279 for ( ; i < args.length; ++i) { | 279 for ( ; i < args.length; ++i) { |
280 if (args[i].startsWith('--')) { | 280 if (args[i].startsWith('--')) { |
281 return i; | 281 return i; |
282 } | 282 } |
283 } | 283 } |
284 return i; | 284 return i; |
285 } | 285 } |
286 } | 286 } |
OLD | NEW |