Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(284)

Side by Side Diff: sdk/lib/_internal/dartdoc/lib/dartdoc.dart

Issue 46063010: Change dart:io Platform.script to return a Uri. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 /** 5 /**
6 * To generate docs for a library, run this script with the path to an 6 * To generate docs for a library, run this script with the path to an
7 * entrypoint .dart file, like: 7 * entrypoint .dart file, like:
8 * 8 *
9 * $ dart dartdoc.dart foo.dart 9 * $ dart dartdoc.dart foo.dart
10 * 10 *
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 const API_LOCATION = 'http://api.dartlang.org/'; 63 const API_LOCATION = 'http://api.dartlang.org/';
64 64
65 /** 65 /**
66 * Gets the full path to the directory containing the entrypoint of the current 66 * Gets the full path to the directory containing the entrypoint of the current
67 * script. In other words, if you invoked dartdoc, directly, it will be the 67 * script. In other words, if you invoked dartdoc, directly, it will be the
68 * path to the directory containing `dartdoc.dart`. If you're running a script 68 * path to the directory containing `dartdoc.dart`. If you're running a script
69 * that imports dartdoc, it will be the path to that script. 69 * that imports dartdoc, it will be the path to that script.
70 */ 70 */
71 // TODO(johnniwinther): Convert to final (lazily initialized) variables when 71 // TODO(johnniwinther): Convert to final (lazily initialized) variables when
72 // the feature is supported. 72 // the feature is supported.
73 String get scriptDir => path.dirname(Platform.script); 73 String get scriptDir => path.dirname(Platform.script.toFilePath());
74 74
75 /** 75 /**
76 * Deletes and recreates the output directory at [path] if it exists. 76 * Deletes and recreates the output directory at [path] if it exists.
77 */ 77 */
78 void cleanOutputDirectory(String path) { 78 void cleanOutputDirectory(String path) {
79 final outputDir = new Directory(path); 79 final outputDir = new Directory(path);
80 if (outputDir.existsSync()) { 80 if (outputDir.existsSync()) {
81 outputDir.deleteSync(recursive: true); 81 outputDir.deleteSync(recursive: true);
82 } 82 }
83 outputDir.createSync(); 83 outputDir.createSync();
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 * to generate navigation for them. 769 * to generate navigation for them.
770 */ 770 */
771 void docNavigationJson() { 771 void docNavigationJson() {
772 startFile('nav.json'); 772 startFile('nav.json');
773 writeln(JSON.encode(createNavigationInfo())); 773 writeln(JSON.encode(createNavigationInfo()));
774 endFile(); 774 endFile();
775 } 775 }
776 /// Whether dartdoc is running from within the Dart SDK or the 776 /// Whether dartdoc is running from within the Dart SDK or the
777 /// Dart source repository. 777 /// Dart source repository.
778 bool get runningFromSdk => 778 bool get runningFromSdk =>
779 path.extension(Platform.script) == '.snapshot'; 779 path.extension(Platform.script.toFilePath()) == '.snapshot';
780 780
781 /// Gets the path to the root directory of the SDK. 781 /// Gets the path to the root directory of the SDK.
782 String get sdkDir => 782 String get sdkDir =>
783 path.dirname(path.dirname(Platform.executable)); 783 path.dirname(path.dirname(Platform.executable));
784 784
785 /// Gets the path to the dartdoc directory normalized for running in different 785 /// Gets the path to the dartdoc directory normalized for running in different
786 /// places. 786 /// places.
787 String get normalizedDartdocPath => path.normalize( 787 String get normalizedDartdocPath => path.normalize(
788 path.absolute(runningFromSdk ? 788 path.absolute(runningFromSdk ?
789 path.join(sdkDir, 'lib', '_internal', 'dartdoc') : 789 path.join(sdkDir, 'lib', '_internal', 'dartdoc') :
(...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after
2311 return ''' 2311 return '''
2312 <div class="mdn"> 2312 <div class="mdn">
2313 $mdnComment 2313 $mdnComment
2314 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div> 2314 <div class="mdn-note"><a href="$mdnUrl">from MDN</a></div>
2315 </div> 2315 </div>
2316 '''; 2316 ''';
2317 } 2317 }
2318 2318
2319 String toString() => mdnComment; 2319 String toString() => mdnComment;
2320 } 2320 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/samples/jsonify/jsonify.dart ('k') | sdk/lib/_internal/dartdoc/test/dartdoc_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698