| OLD | NEW |
| 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:path/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 /** |
| (...skipping 19 matching lines...) Expand all Loading... |
| 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'); |
| OLD | NEW |