Chromium Code Reviews| Index: runtime/bin/builtin.dart |
| diff --git a/runtime/bin/builtin.dart b/runtime/bin/builtin.dart |
| index 700eed70960f384972893ed7f3f6635c7b1176b8..a67038948b56c189c7f33838dc49c50982fe69ed 100644 |
| --- a/runtime/bin/builtin.dart |
| +++ b/runtime/bin/builtin.dart |
| @@ -77,6 +77,7 @@ void _makeHttpRequest(String uri) { |
| // Are we running on Windows? |
| var _isWindows = false; |
| +var _workingWindowsDrivePrefix; |
| // The current working directory |
| var _workingDirectoryUri; |
| // The URI that the entry point script was loaded from. Remembered so that |
| @@ -123,8 +124,18 @@ _enforceTrailingSlash(uri) { |
| return uri; |
| } |
| +_extractDriveLetterPrefix(cwd) { |
| + if (!_isWindows) { |
| + return null; |
| + } |
| + if (cwd.length > 1 && cwd[1] == ':') { |
| + return '/${cwd[0]}:'; |
| + } |
| + return null; |
| +} |
| void _setWorkingDirectory(cwd) { |
| + _workingWindowsDrivePrefix = _extractDriveLetterPrefix(cwd); |
| cwd = _sanitizeWindowsPath(cwd); |
| cwd = _enforceTrailingSlash(cwd); |
| _workingDirectoryUri = new Uri(scheme: 'file', path: cwd); |
| @@ -227,8 +238,19 @@ String _filePathFromFileUri(Uri uri) { |
| throw "URIs using the 'file:' scheme may not contain a host."; |
| } |
| - _logResolution('# Path: $uri -> ${uri.path}'); |
| - return uri.path; |
| + String path = uri.path; |
| + _logResolution('# Path: $uri -> ${path}'); |
| + if (_isWindows && (path.length > 2) && path.startsWith('/') && |
| + (path[2] != ':')) { |
|
zra
2013/08/14 16:38:12
Is this (path[2] != ':') checking that the path is
Cutch
2013/08/14 20:29:08
Done.
|
| + if (_workingWindowsDrivePrefix == null) { |
| + throw 'Could not determine windows drive letter prefix.'; |
| + } |
| + // Absolute path on Windows without a drive letter. |
| + _logResolution('# Path: Windows absolute path needs a drive letter.' |
| + ' Prepending $_workingWindowsDrivePrefix.'); |
| + path = '$_workingWindowsDrivePrefix$path'; |
| + } |
| + return path; |
| } |