Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #110 from davidmorgan/test-dir-finder
Browse files Browse the repository at this point in the history
Simplify data directory finding.
  • Loading branch information
davidmorgan authored Aug 13, 2020
2 parents ff4a4c4 + eb2b131 commit b20a558
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions test/data_directory.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@ bool _isIntlRoot(String dir) {
}

String get packageDirectory {
// TODO(alanknight): We can also do this using mirrors, which may
// be better. See dart_style/test/utils.dart for an example.
// Try the current directory.
if (_isIntlRoot(Directory.current.path)) return Directory.current.path;

// Search upwards from the script location.
var script = Platform.script;
// If being run in package:test, we're in an isolate with a data URI, so
// just assume the current directory is the package.
if (script.scheme == 'data') {
return Directory.current.path;
}
var dir = path.fromUri(Platform.script);
var root = path.rootPrefix(dir);

Expand Down

0 comments on commit b20a558

Please sign in to comment.