| Index: pkg/analyzer/lib/src/generated/source_io.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/source_io.dart b/pkg/analyzer/lib/src/generated/source_io.dart
|
| index 4708aa0b97a905835f80482b8caae8182ceb9a38..0c5d9e8171d862a8444619681eea04e661322c3e 100644
|
| --- a/pkg/analyzer/lib/src/generated/source_io.dart
|
| +++ b/pkg/analyzer/lib/src/generated/source_io.dart
|
| @@ -467,15 +467,15 @@ class PackageUriResolver extends UriResolver {
|
|
|
| @override
|
| Uri restoreAbsolute(Source source) {
|
| - String sourcePath = source.fullName;
|
| + String sourceUri = _toFileUri(source.fullName);
|
| for (JavaFile packagesDirectory in _packagesDirectories) {
|
| List<JavaFile> pkgFolders = packagesDirectory.listFiles();
|
| if (pkgFolders != null) {
|
| for (JavaFile pkgFolder in pkgFolders) {
|
| try {
|
| - String pkgCanonicalPath = pkgFolder.getCanonicalPath();
|
| - if (sourcePath.startsWith(pkgCanonicalPath)) {
|
| - String relPath = sourcePath.substring(pkgCanonicalPath.length);
|
| + String pkgCanonicalUri = _toFileUri(pkgFolder.getCanonicalPath());
|
| + if (sourceUri.startsWith(pkgCanonicalUri)) {
|
| + String relPath = sourceUri.substring(pkgCanonicalUri.length);
|
| return parseUriWithException(
|
| "$PACKAGE_SCHEME:${pkgFolder.getName()}$relPath");
|
| }
|
| @@ -501,6 +501,13 @@ class PackageUriResolver extends UriResolver {
|
| }
|
|
|
| /**
|
| + * Convert the given file path to a "file:" URI. On Windows, this transforms
|
| + * backslashes to forward slashes.
|
| + */
|
| + String _toFileUri(String filePath) =>
|
| + JavaFile.pathContext.toUri(filePath).toString();
|
| +
|
| + /**
|
| * Return `true` if the given URI is a `package` URI.
|
| *
|
| * @param uri the URI being tested
|
|
|