Open
Description
Platform.script.toFilePath() duplicates next to current directory, when run recursively from itself.
To repro, follow the devtools release steps, and get the issue on the step devtools_tool release-helper
.
The script is available in PATH that contains /Users/polinach/_/devtools/tool/bin
, and it is run initially from /Users/polinach/_/devtools
, and then switches directory with Directory.current = pathFromRepoRoot("tool");
,
and then runs itself and new instance returns wrong value for Platform.script.toFilePath()
.
Code:
print(Directory.current);
print(Platform.script.toFilePath());
Actual output:
Directory: '/Users/polinach/_/devtools/tool'
/Users/polinach/_/devtools/tool/tool/bin/devtools_tool.dart
Expected output:
Directory: '/Users/polinach/_/devtools/tool'
/Users/polinach/_/devtools/tool/bin/devtools_tool.dart
(cd tool
solves the problem)