From eb2b13166b0be7b7fc9146b00bbd442aebb41459 Mon Sep 17 00:00:00 2001 From: David Morgan Date: Thu, 13 Aug 2020 13:22:09 +0200 Subject: [PATCH] Simplify data directory finding. --- test/data_directory.dart | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/test/data_directory.dart b/test/data_directory.dart index 3485201..0b07b98 100644 --- a/test/data_directory.dart +++ b/test/data_directory.dart @@ -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);