Index: runtime/bin/vmservice/loader.dart |
diff --git a/runtime/bin/vmservice/loader.dart b/runtime/bin/vmservice/loader.dart |
index a72e735df2cbe3f27bba5d090a49fad0c0dc42db..7710fe008ac0cca3f17472a5b5475d5f0015d30a 100644 |
--- a/runtime/bin/vmservice/loader.dart |
+++ b/runtime/bin/vmservice/loader.dart |
@@ -953,7 +953,10 @@ const _Dart_kResourceLoad = 5; // Resource class support. |
const _Dart_kGetPackageRootUri = 6; // Uri of the packages/ directory. |
const _Dart_kGetPackageConfigUri = 7; // Uri of the .packages file. |
const _Dart_kResolvePackageUri = 8; // Resolve a package: uri. |
+ |
+// Extra requests. Keep these in sync between loader.dart and loader.cc. |
const _Dart_kImportExtension = 9; // Import a dart-ext: file. |
+const _Dart_kResolveAsFilePath = 10; // Resolve uri to file path. |
// External entry point for loader requests. |
_processLoadRequest(request) { |
@@ -1115,6 +1118,36 @@ _processLoadRequest(request) { |
break; |
} |
break; |
+ case _Dart_kResolveAsFilePath: |
+ String uri = request[4]; |
+ Uri resolvedUri = Uri.parse(uri); |
+ try { |
+ if (resolvedUri.scheme == 'package') { |
+ resolvedUri = loaderState._resolvePackageUri(resolvedUri); |
+ } |
+ if (resolvedUri.scheme == '' || resolvedUri.scheme == 'file') { |
+ resolvedUri = loaderState._workingDirectory.resolveUri(resolvedUri); |
+ var msg = new List(5); |
+ msg[0] = tag; |
+ msg[1] = uri; |
+ msg[2] = resolvedUri.toString(); |
+ msg[3] = null; |
+ msg[4] = resolvedUri.toFilePath(); |
+ sp.send(msg); |
+ } else { |
+ throw "Cannot resolve scheme (${resolvedUri.scheme}) to file path" |
+ " for $resolvedUri"; |
+ } |
+ } catch (e) { |
+ var msg = new List(5); |
+ msg[0] = -tag; |
+ msg[1] = uri; |
+ msg[2] = resolvedUri.toString(); |
+ msg[3] = null; |
+ msg[4] = e.toString(); |
+ sp.send(msg); |
+ } |
+ break; |
default: |
_log('Unknown loader request tag=$tag from $isolateId'); |
} |