Improve error message when missing the package-root
This commit is contained in:
@@ -23,8 +23,11 @@ class ArtifactStore {
|
||||
static String _engineRevision;
|
||||
|
||||
static String get engineRevision {
|
||||
if (_engineRevision == null)
|
||||
_engineRevision = new File(path.join(packageRoot, 'sky_engine', 'REVISION')).readAsStringSync();
|
||||
if (_engineRevision == null) {
|
||||
File revisionFile = new File(path.join(packageRoot, 'sky_engine', 'REVISION'));
|
||||
if (revisionFile.existsSync())
|
||||
_engineRevision = revisionFile.readAsStringSync();
|
||||
}
|
||||
return _engineRevision;
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,18 @@ class FlutterCommandRunner extends CommandRunner {
|
||||
Logger.root.level = Level.FINE;
|
||||
|
||||
ArtifactStore.packageRoot = globalResults['package-root'];
|
||||
if (!FileSystemEntity.isDirectorySync(ArtifactStore.packageRoot)) {
|
||||
String message = '${ArtifactStore.packageRoot} is not a valid directory.';
|
||||
if (ArtifactStore.packageRoot == 'packages') {
|
||||
if (FileSystemEntity.isFileSync('pubspec.yaml'))
|
||||
message += '\nDid you run `pub get` in this directory?';
|
||||
else
|
||||
message += '\nDid you run this command from the same directory as your pubspec.yaml file?';
|
||||
}
|
||||
_logging.severe(message);
|
||||
return 2;
|
||||
}
|
||||
|
||||
buildConfigurations = _createBuildConfigurations(globalResults);
|
||||
|
||||
return super.runCommand(globalResults);
|
||||
|
||||
Reference in New Issue
Block a user