[fuchsia_reload] Fix command line argument checking (#9434)

This commit is contained in:
Zachary Anderson
2017-04-17 15:21:12 -07:00
committed by GitHub
parent fc58bd7679
commit b645e4ea3c

View File

@@ -195,9 +195,12 @@ class FuchsiaReloadCommand extends FlutterCommand {
return;
}
final List<String> gnTarget = _extractPathAndName(argResults['gn-target']);
_projectRoot = gnTarget[0];
_projectName = gnTarget[1];
final String gnTarget = argResults['gn-target'];
if (gnTarget == null)
throwToolExit('Give the GN target with --gn-target(-g).');
final List<String> targetInfo = _extractPathAndName(gnTarget);
_projectRoot = targetInfo[0];
_projectName = targetInfo[1];
_fuchsiaProjectPath = '$_fuchsiaRoot/$_projectRoot';
if (!_directoryExists(_fuchsiaProjectPath))
throwToolExit('Target does not exist in the Fuchsia tree: $_fuchsiaProjectPath.');