Chromium Code Reviews| Index: pkg/path/lib/path.dart |
| diff --git a/pkg/path/lib/path.dart b/pkg/path/lib/path.dart |
| index cc882f47f94ec460de01cea5264018b7ff8a941a..4b9b7030bb093a623e190659c1ac3742eb0bdb4d 100644 |
| --- a/pkg/path/lib/path.dart |
| +++ b/pkg/path/lib/path.dart |
| @@ -438,10 +438,14 @@ class Builder { |
| // If the root prefixes don't match (for example, different drive letters |
| // on Windows), then there is no relative path, so just return the absolute |
| - // one. |
| - // TODO(rnystrom): Drive letters are case-insentive on Windows. Should |
| - // handle "C:\" and "c:\" being the same root. |
| - if (fromParsed.root != pathParsed.root) return pathParsed.toString(); |
| + // one. In Windows, drive letters are case-insenstive and we allow |
| + // calculation of relative paths, even if a path has not been normalized. |
| + if (fromParsed.root != pathParsed.root && |
| + ((fromParsed.root == null || pathParsed.root == null) || |
|
Jennifer Messerly
2013/01/12 23:36:01
looks like an extra space after == ?
Emily Fortuna
2013/01/12 23:43:32
Done.
|
| + fromParsed.root.toLowerCase().replaceAll('/', '\\') != |
| + pathParsed.root.toLowerCase().replaceAll('/', '\\'))) { |
| + return pathParsed.toString(); |
| + } |
| // Strip off their common prefix. |
| while (fromParsed.parts.length > 0 && pathParsed.parts.length > 0 && |
| @@ -644,6 +648,10 @@ class _ParsedPath { |
| parts = newParts; |
| separators = newSeparators; |
| + // Normalize the Windows root if needed. |
| + if (root != null && !root.startsWith('//') && style == Style.windows) { |
|
Jennifer Messerly
2013/01/12 23:36:01
I think we do want to normalize UNC to r"\\" as we
Jennifer Messerly
2013/01/12 23:37:50
oops wrong link. this one is better:
http://en.wik
Emily Fortuna
2013/01/12 23:43:32
Done.
|
| + root = root.replaceAll('/', '\\'); |
| + } |
| removeTrailingSeparators(); |
| } |