| 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 /** | 5 /** |
| 6 * This program reads the HTML libraries from [LIB_PATH] and outputs their | 6 * This program reads the HTML libraries from [LIB_PATH] and outputs their |
| 7 * documentation to [JSON_PATH]. | 7 * documentation to [JSON_PATH]. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 import 'dart:io'; | 10 import 'dart:io'; |
| 11 import 'dart:async'; | 11 import 'dart:async'; |
| 12 | 12 |
| 13 import 'package:path/path.dart' as path; |
| 14 |
| 13 import '../lib/docs.dart'; | 15 import '../lib/docs.dart'; |
| 14 | 16 |
| 15 final Path json_path = scriptDir.append('../docs.json').canonicalize(); | 17 final String json_path = |
| 16 final Path lib_path = scriptDir.append('../../../../sdk/').canonicalize(); | 18 path.normalize(path.join(scriptDir, '..', 'docs.json')); |
| 19 final String lib_path = |
| 20 path.normalize(path.join(scriptDir, '..', '..', '..', '..', 'sdk')); |
| 17 | 21 |
| 18 main() { | 22 main() { |
| 19 print('Converting HTML docs from $lib_path to $json_path.'); | 23 print('Converting HTML docs from $lib_path to $json_path.'); |
| 20 | 24 |
| 21 convert(lib_path, json_path) | 25 convert(lib_path, json_path) |
| 22 .then((bool anyErrors) { | 26 .then((bool anyErrors) { |
| 23 print('Converted HTML docs ${anyErrors ? "with": "without"}' | 27 print('Converted HTML docs ${anyErrors ? "with": "without"}' |
| 24 ' errors.'); | 28 ' errors.'); |
| 25 }); | 29 }); |
| 26 } | 30 } |
| 27 | 31 |
| 28 /** | 32 /** |
| 29 * Gets the full path to the directory containing the entrypoint of the current | 33 * Gets the full path to the directory containing the entrypoint of the current |
| 30 * script. | 34 * script. |
| 31 */ | 35 */ |
| 32 Path get scriptDir => | 36 String get scriptDir => path.dirname(new Options().script); |
| 33 new Path(new Options().script).directoryPath; | |
| OLD | NEW |