Skip to content

Platform.script.toFilePath() duplicates next to current directory.Β #54493

Open
@polina-c

Description

@polina-c

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-toolsA meta category for issues that should be addressed by tooling (prefer more concrete areas).web-triage-0repro is available

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions