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

Unified Diff: sdk/lib/_internal/pub/lib/src/sdk.dart

Issue 207423003: Support Dart core libraries in source maps. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. Created 6 years, 9 months 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
Index: sdk/lib/_internal/pub/lib/src/sdk.dart
diff --git a/sdk/lib/_internal/pub/lib/src/sdk.dart b/sdk/lib/_internal/pub/lib/src/sdk.dart
index bd8314b2062d891a77dd073c687324f759cabd43..a97df46a4bdd4f234c813bd9ab2e35c1f441c741 100644
--- a/sdk/lib/_internal/pub/lib/src/sdk.dart
+++ b/sdk/lib/_internal/pub/lib/src/sdk.dart
@@ -13,10 +13,17 @@ import 'io.dart';
import 'version.dart';
/// Gets the path to the root directory of the SDK.
-String get rootDirectory {
- // Assume the Dart executable is always coming from the SDK.
- return path.dirname(path.dirname(Platform.executable));
-}
+///
+/// When running from the actual built SDK, this will be the SDK that contains
+/// the running Dart executable. When running from the repo, it will be the
+/// "sdk" directory in the Dart repository itself.
+String get rootDirectory =>
+ runningFromSdk ? _rootDirectory : path.join(repoRoot, "sdk");
+
+/// Gets the path to the root directory of the SDK, assuming that the currently
+/// running Dart executable is within it.
+String get _rootDirectory =>
+ path.dirname(path.dirname(Platform.executable));
/// The SDK's revision number formatted to be a semantic version.
///
@@ -33,7 +40,7 @@ Version _getVersion() {
if (sdkVersion != null) return new Version.parse(sdkVersion);
// Read the "version" file.
- var revisionPath = path.join(rootDirectory, "version");
+ var revisionPath = path.join(_rootDirectory, "version");
var version = readTextFile(revisionPath).trim();
return new Version.parse(version);
}

Powered by Google App Engine
This is Rietveld 408576698