Chromium Code Reviews| Index: utils/pub/io.dart |
| diff --git a/utils/pub/io.dart b/utils/pub/io.dart |
| index a85c7c3efbea2314ae1a20a4541c90f94953d5ba..d98002f260e6b47057d5c30a6f4d483e928dc709 100644 |
| --- a/utils/pub/io.dart |
| +++ b/utils/pub/io.dart |
| @@ -372,15 +372,16 @@ String getFullPath(entry) { |
| String relativeToPub(String path) { |
| var scriptPath = new File(new Options().script).fullPathSync(); |
| - // Walk up until we hit the "utils" directory. This lets us figure out where |
| + // Walk up until we hit the "util(s)" directory. This lets us figure out where |
| // we are if this function is called from pub.dart, or one of the tests, |
| - // which also live under "utils". |
| - var utilsDir = new Path.fromNative(scriptPath).directoryPath; |
| - while (utilsDir.filename != 'utils') { |
| - utilsDir = utilsDir.directoryPath; |
| + // which also live under "utils", or from the SDK where pub is in "util". |
| + var utilDir = new Path.fromNative(scriptPath).directoryPath; |
| + while ((utilDir.filename != 'utils') && (utilDir.filename != 'util')) { |
|
nweiz
2012/11/29 22:12:08
Unnecessary parentheses. Have faith in operator pr
Bob Nystrom
2012/12/04 21:38:24
Done. It is not my faith I question, but those of
|
| + if (utilDir.filename == '') throw 'Could not find path to pub.'; |
| + utilDir = utilDir.directoryPath; |
| } |
| - return utilsDir.append('pub').append(path).canonicalize().toNativePath(); |
| + return utilDir.append('pub').append(path).canonicalize().toNativePath(); |
| } |
| /// A StringInputStream reading from stdin. |