Support launching flutter_tools from a package URI (#23476)

This commit is contained in:
Jason Simmons
2018-10-24 14:41:16 -07:00
committed by GitHub
parent d00a549f2d
commit 549e8e07c6

View File

@@ -183,6 +183,12 @@ class FlutterCommandRunner extends CommandRunner<void> {
try {
if (platform.script.scheme == 'data')
return '../..'; // we're running as a test
if (platform.script.scheme == 'package') {
final String packageConfigPath = Uri.parse(platform.packageConfig).toFilePath();
return fs.path.dirname(fs.path.dirname(fs.path.dirname(packageConfigPath)));
}
final String script = platform.script.toFilePath();
if (fs.path.basename(script) == kSnapshotFileName)
return fs.path.dirname(fs.path.dirname(fs.path.dirname(script)));