Commit d9af9399 authored by Adam Barth's avatar Adam Barth

Improve error message when missing the package-root

parent 9c483510
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment