Chromium Code Reviews| 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. |
|
Alan Knight
2013/03/15 22:24:50
I think this is stale, this code changed quite sig
Ivan Posva
2013/03/15 22:47:36
Noticed the conflict. Will reupload...
| |
| 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. | 8 * directories. |
| 9 */ | 9 */ |
| 10 library data_directory; | 10 library data_directory; |
| 11 | 11 |
| 12 import 'dart:io'; | 12 import 'dart:io'; |
| 13 | 13 |
| 14 String get _sep => Platform.pathSeparator; | 14 String get _sep => Platform.pathSeparator; |
| 15 | 15 |
| 16 get dataDirectory { | 16 get dataDirectory { |
| 17 var current = new Directory.current().path; | 17 var dir = new Directory.current(); |
| 18 var current = dir.path; | |
| 18 if (new RegExp('.*${_sep}test').hasMatch(current)) { | 19 if (new RegExp('.*${_sep}test').hasMatch(current)) { |
| 19 return '..${_sep}lib${_sep}src${_sep}data${_sep}dates${_sep}'; | 20 return '..${_sep}lib${_sep}src${_sep}data${_sep}dates${_sep}'; |
| 20 } | 21 } |
| 21 if (new RegExp('.*${_sep}intl').hasMatch(current)) { | 22 if (new RegExp('.*${_sep}intl').hasMatch(current)) { |
| 22 return 'lib${_sep}src${_sep}data${_sep}dates${_sep}'; | 23 return 'lib${_sep}src${_sep}data${_sep}dates${_sep}'; |
| 23 } | 24 } |
| 24 return 'pkg${_sep}intl${_sep}lib${_sep}src${_sep}data${_sep}dates${_sep}'; | 25 if (new Directory('${dir.path}${_sep}pkg').existsSync()) { |
|
kustermann
2013/03/15 22:21:36
Use current instead of dir.path?
Ivan Posva
2013/03/15 22:25:57
Changed all instances to cwd instead.
| |
| 26 return 'pkg${_sep}intl${_sep}lib${_sep}src${_sep}data${_sep}dates${_sep}'; | |
| 27 } else if (new Directory('${dir.path}${_sep}..${_sep}pkg').existsSync()) { | |
| 28 return '..${_sep}pkg${_sep}intl${_sep}lib${_sep}src${_sep}data${_sep}dates${ _sep}'; | |
|
kustermann
2013/03/15 22:21:36
long line
Ivan Posva
2013/03/15 22:25:57
Done.
| |
| 29 } | |
| 30 throw new UnsupportedError('Cannot find pkg${_sep}intl directory'); | |
| 25 } | 31 } |
| OLD | NEW |