Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(697)

Side by Side Diff: pkg/intl/test/data_directory.dart

Issue 14270009: Explain better than the en_US locale is always available, fix other doc glitches. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/intl/lib/number_format.dart ('k') | pkg/intl/test/date_time_format_test_core.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /** 5 /**
6 * A utility function for test and tools that compensates (at least for very 6 * A utility function for test and tools that compensates (at least for very
7 * simple cases) for file-dependent programs being run from different 7 * simple cases) for file-dependent programs being run from different
8 * directories. The important cases are 8 * directories. The important cases are
9 * -running in the directory that contains the test itself, i.e. 9 * -running in the directory that contains the test itself, i.e.
10 * pkg/intl/test or a sub-directory. 10 * pkg/intl/test or a sub-directory.
11 * -running in pkg/intl, which is where the editor will run things by default 11 * -running in pkg/intl, which is where the editor will run things by default
12 * -running in the top-level dart directory, where the build tests run 12 * -running in the top-level dart directory, where the build tests run
13 */ 13 */
14 library data_directory; 14 library data_directory;
15 15
16 import "dart:io"; 16 import "dart:io";
17 import "package:pathos/path.dart" as path; 17 import "package:pathos/path.dart" as path;
18 18
19 String get dataDirectory { 19 String get dataDirectory {
20 return path.join(intlDirectory, datesRelativeToIntl); 20 return path.join(intlDirectory, datesRelativeToIntl);
21 } 21 }
22 22
23 String get intlDirectory { 23 String get intlDirectory {
24 var components = path.split(path.current); 24 var components = path.split(path.current);
25 var foundIntlDir = false; 25 var foundIntlDir = false;
26 26
27 /** 27 /**
28 * A helper function that returns false (indicating we should stop iterating) 28 * A helper function that returns false (indicating we should stop iterating)
29 * if the argument to the previous call was 'intl' and also sets 29 * if the argument to the previous call was 'intl' and also sets
30 * the outer scope [foundIntl]. 30 * the outer scope [foundIntlDir].
31 */ 31 */
32 bool checkForIntlDir(String each) { 32 bool checkForIntlDir(String each) {
33 if (foundIntlDir) return false; 33 if (foundIntlDir) return false;
34 foundIntlDir = (each == 'intl') ? true : false; 34 foundIntlDir = (each == 'intl') ? true : false;
35 return true; 35 return true;
36 } 36 }
37 37
38 var pathUpToIntl = components.takeWhile(checkForIntlDir).toList(); 38 var pathUpToIntl = components.takeWhile(checkForIntlDir).toList();
39 // We assume that if we're not somewhere underneath the intl hierarchy 39 // We assume that if we're not somewhere underneath the intl hierarchy
40 // that we are in the dart root. 40 // that we are in the dart root.
41 if (foundIntlDir) { 41 if (foundIntlDir) {
42 return path.joinAll(pathUpToIntl); 42 return path.joinAll(pathUpToIntl);
43 } else { 43 } else {
44 if (new Directory(path.join(path.current, 'pkg', 'intl')).existsSync()) { 44 if (new Directory(path.join(path.current, 'pkg', 'intl')).existsSync()) {
45 return path.join(path.current, 'pkg', 'intl'); 45 return path.join(path.current, 'pkg', 'intl');
46 } 46 }
47 if (new Directory( 47 if (new Directory(
48 path.join(path.current, '..', 'pkg', 'intl')).existsSync()) { 48 path.join(path.current, '..', 'pkg', 'intl')).existsSync()) {
49 return path.join(path.current, '..', 'pkg', 'intl'); 49 return path.join(path.current, '..', 'pkg', 'intl');
50 } 50 }
51 } 51 }
52 throw new UnsupportedError( 52 throw new UnsupportedError(
53 'Cannot find ${path.join('pkg','intl')} directory.'); 53 'Cannot find ${path.join('pkg','intl')} directory.');
54 } 54 }
55 55
56 String get datesRelativeToIntl => path.join('lib', 'src', 'data', 'dates'); 56 String get datesRelativeToIntl => path.join('lib', 'src', 'data', 'dates');
OLDNEW
« no previous file with comments | « pkg/intl/lib/number_format.dart ('k') | pkg/intl/test/date_time_format_test_core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698