Index: utils/pub/sdk_source.dart |
diff --git a/utils/pub/sdk_source.dart b/utils/pub/sdk_source.dart |
index 3662f853fa4530280307cbfe9e5b2369fb43aa6c..53a4664b846b7f775ef5804a8a4692c8f384126d 100644 |
--- a/utils/pub/sdk_source.dart |
+++ b/utils/pub/sdk_source.dart |
@@ -13,8 +13,6 @@ |
* |
* This currently uses the "sdkdir" command-line argument to find the SDK. |
*/ |
-// TODO(nweiz): This should read the SDK directory from an environment variable |
-// once we can set those for tests. |
class SdkSource extends Source { |
final String name = "sdk"; |
final bool shouldCache = false; |
@@ -22,9 +20,15 @@ class SdkSource extends Source { |
/** |
* The root directory of the Dart SDK. |
*/ |
- final String rootDir; |
+ final String _rootDir; |
- SdkSource(this.rootDir); |
+ String get rootDir() { |
+ if (_rootDir != null) return _rootDir; |
+ throw "Pub can't find the Dart SDK. Please set the DART_SDK environment " |
+ "variable to the Dart SDK directory."; |
+ } |
+ |
+ SdkSource(this._rootDir); |
/** |
* An SDK package has no dependencies. Its version number is inferred from the |