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

Unified Diff: pkg/docgen/lib/src/package_helpers.dart

Issue 737033002: Let docgen detect a dart-sdk directory that's differently named, and do it correctly on bleeding ed… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: A much better implementation, actually use the --sdk value Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/docgen/lib/src/generator.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/docgen/lib/src/package_helpers.dart
diff --git a/pkg/docgen/lib/src/package_helpers.dart b/pkg/docgen/lib/src/package_helpers.dart
index ca189fa15c08d64b463e791d02f2a1805d744819..f437166e6e2d5d7b4073219bb92e24f95233b268 100644
--- a/pkg/docgen/lib/src/package_helpers.dart
+++ b/pkg/docgen/lib/src/package_helpers.dart
@@ -12,19 +12,19 @@ import 'package:path/path.dart' as path;
import 'package:yaml/yaml.dart';
/// Helper accessor to determine the full pathname of the root of the dart
-/// checkout. We can be in one of three situations:
-/// 1) Running from pkg/docgen/bin/docgen.dart
-/// 2) Running from a snapshot in a build,
-/// e.g. xcodebuild/ReleaseIA32/dart-sdk/bin
-/// 3) Running from a built distribution,
-/// e.g. ...somename/dart-sdk/bin/snapshots
+/// checkout if we are running without the --sdk parameter specified. That
+/// normally means we are running directly from source, and we expect to
+/// find the root as the directory above 'pkg'. The only other time this
+/// would happen is running a snapshot directly, rather than from the
+/// dartdocgen script, where we look for the dart-sdk directory. If not
+/// using the script and not in a normal directory structure, you'll need
+/// to pass the --sdk parameter.
String get rootDirectory {
if (_rootDirectoryCache != null) return _rootDirectoryCache;
var scriptDir = path.absolute(path.dirname(Platform.script.toFilePath()));
var root = scriptDir;
var base = path.basename(root);
- // When we find dart-sdk or sdk we are one level below the root.
- while (base != 'dart-sdk' && base != 'sdk' && base != 'pkg') {
+ while (base != 'dart-sdk' && base != 'pkg') {
root = path.dirname(root);
base = path.basename(root);
if (root == base) {
« no previous file with comments | « pkg/docgen/lib/src/generator.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698