Skip to content

Can't get path to current script #1145

Closed
@munificent

Description

@munificent

When writing Dart scripts that read other files, it's helpful if you can identify that file with a path that's relative to the script itself. Right now, I don't think there's a way to get that in Dart. Instead, paths are always relative to where Dart was invoked from. This causes problems if you want to invoke the same script from different paths and have it still be able to reliably find files.

For example, I have a unit test (utils/tests/dartdoc/src/dartdoc_tests.dart) that wants to load a file in its same directory (dummy.dart). This unit test is run both through test.dart and frog's presubmit.py from different paths. Short of "let me see if it's here? no, how about here?" kind of hacks, I don't know of a clean way to support that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.type-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions