Chromium Code Reviews| Index: pkg/intl/test/data_directory.dart |
| diff --git a/pkg/intl/test/data_directory.dart b/pkg/intl/test/data_directory.dart |
| index de16e00d0b8378abbdd9d0da398cfe7b52af22db..8e303f907e9bab3f00da3d782fa061442e669736 100644 |
| --- a/pkg/intl/test/data_directory.dart |
| +++ b/pkg/intl/test/data_directory.dart |
| @@ -17,25 +17,28 @@ import "dart:io"; |
| import "package:pathos/path.dart" as path; |
| String get dataDirectory { |
| - return path.join(intlDirectory, datesRelativeToIntl); |
| + return path.join(intlDirectory(), datesRelativeToIntl); |
| } |
| -String get intlDirectory { |
| +String intlDirectory() { |
| var components = path.split(path.current); |
| var foundIntlDir = false; |
| - /** |
| - * A helper function that returns false (indicating we should stop iterating) |
| - * if the argument to the previous call was 'intl' and also sets |
| - * the outer scope [foundIntl]. |
| - */ |
| - bool checkForIntlDir(String each) { |
| - if (foundIntlDir) return false; |
| - foundIntlDir = (each == 'intl') ? true : false; |
| - return true; |
| + List findPathUpToIntl() { |
| + var result = []; |
| + for (var each in components) { |
|
Siggi Cherem (dart-lang)
2013/04/23 02:12:51
nit: 'each' => 'segment' or 'component'?
(general
Emily Fortuna
2013/04/23 17:24:48
+1
Alan Knight
2013/04/23 17:59:56
This is moot, because this file's changes were bec
Siggi Cherem (dart-lang)
2013/04/23 18:56:37
sure - I noticed that the original code is also us
Alan Knight
2013/04/23 21:37:19
Done.
|
| + if (each == 'intl') { |
| + foundIntlDir = true; |
| + result.add(each); |
| + return result; |
| + } else { |
| + result.add(each); |
| + } |
| + } |
| + return result; |
| } |
| - var pathUpToIntl = components.takeWhile(checkForIntlDir).toList(); |
| + var pathUpToIntl = findPathUpToIntl(); |
| // We assume that if we're not somewhere underneath the intl hierarchy |
| // that we are in the dart root. |
| if (foundIntlDir) { |