| Index: pkg/analysis_server/test/mock_sdk.dart
|
| diff --git a/pkg/analysis_server/test/mock_sdk.dart b/pkg/analysis_server/test/mock_sdk.dart
|
| index 9027e6d05e6b5d9045cbc842e193b92e8208a6e0..ab40d919541f0d7e61ee8137c7f2b8518d615565 100644
|
| --- a/pkg/analysis_server/test/mock_sdk.dart
|
| +++ b/pkg/analysis_server/test/mock_sdk.dart
|
| @@ -334,28 +334,26 @@ const Map<String, LibraryInfo> libraries = const {
|
|
|
| @override
|
| Source fromFileUri(Uri uri) {
|
| - String filePath = uri.path;
|
| - String libPath = '/lib';
|
| - if (!filePath.startsWith("$libPath/")) {
|
| - return null;
|
| - }
|
| - for (SdkLibrary library in LIBRARIES) {
|
| - String libraryPath = library.path;
|
| - if (filePath.replaceAll('\\', '/') == libraryPath) {
|
| + String filePath = provider.pathContext.fromUri(uri);
|
| + for (SdkLibrary library in sdkLibraries) {
|
| + String libraryPath = provider.convertPath(library.path);
|
| + if (filePath == libraryPath) {
|
| try {
|
| - resource.File file = provider.getResource(uri.path);
|
| + resource.File file = provider.getResource(filePath);
|
| Uri dartUri = Uri.parse(library.shortName);
|
| return file.createSource(dartUri);
|
| } catch (exception) {
|
| return null;
|
| }
|
| }
|
| - if (filePath.startsWith("$libraryPath/")) {
|
| - String pathInLibrary = filePath.substring(libraryPath.length + 1);
|
| - String path = '${library.shortName}/$pathInLibrary';
|
| + String libraryRootPath = provider.pathContext.dirname(libraryPath) +
|
| + provider.pathContext.separator;
|
| + if (filePath.startsWith(libraryRootPath)) {
|
| + String pathInLibrary = filePath.substring(libraryRootPath.length);
|
| + String uriStr = '${library.shortName}/$pathInLibrary';
|
| try {
|
| - resource.File file = provider.getResource(uri.path);
|
| - Uri dartUri = new Uri(scheme: 'dart', path: path);
|
| + resource.File file = provider.getResource(filePath);
|
| + Uri dartUri = Uri.parse(uriStr);
|
| return file.createSource(dartUri);
|
| } catch (exception) {
|
| return null;
|
|
|