Skip to content

Commit f9314a3

Browse files
[tool] Support running main.dart (#4208)
The change to how the repository is located assumed the script was being run from bin/flutter_plugin_tools.dart, but it can also be run directly from lib/src/main.dart which was broken. This restores the ability to run it either way. Fixes the tree breakage in `release`.
1 parent eed9b68 commit f9314a3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

script/tool/lib/src/main.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ import 'xcode_analyze_command.dart';
4141

4242
void main(List<String> args) {
4343
const FileSystem fileSystem = LocalFileSystem();
44-
final Directory scriptBinDir =
44+
final Directory scriptDir =
4545
fileSystem.file(io.Platform.script.toFilePath()).parent;
46-
final Directory root = scriptBinDir.parent.parent.parent;
46+
// Support running either via directly invoking main.dart, or the wrapper in
47+
// bin/.
48+
final Directory toolsDir =
49+
scriptDir.basename == 'bin' ? scriptDir.parent : scriptDir.parent.parent;
50+
final Directory root = toolsDir.parent.parent;
4751
final Directory packagesDir = root.childDirectory('packages');
4852

4953
if (!packagesDir.existsSync()) {

0 commit comments

Comments
 (0)