OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of vmservice_io; | 5 part of vmservice_io; |
6 | 6 |
7 _sanitizeWindowsPath(path) { | 7 _sanitizeWindowsPath(path) { |
8 // For Windows we need to massage the paths a bit according to | 8 // For Windows we need to massage the paths a bit according to |
9 // http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx | 9 // http://blogs.msdn.com/b/ie/archive/2006/12/06/file-uris-in-windows.aspx |
10 // | 10 // |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1124 break; | 1124 break; |
1125 default: | 1125 default: |
1126 if (traceLoading) { | 1126 if (traceLoading) { |
1127 _log('Unknown scheme (${pathUri.scheme}) in $pathUri.'); | 1127 _log('Unknown scheme (${pathUri.scheme}) in $pathUri.'); |
1128 } | 1128 } |
1129 _sendExtensionImportResponse(sp, uri, libraryUri, null); | 1129 _sendExtensionImportResponse(sp, uri, libraryUri, null); |
1130 break; | 1130 break; |
1131 } | 1131 } |
1132 break; | 1132 break; |
1133 case _Dart_kResolveAsFilePath: | 1133 case _Dart_kResolveAsFilePath: |
1134 String uri = request[4]; | 1134 loaderState._triggerPackageResolution(() { |
1135 Uri resolvedUri = Uri.parse(_sanitizeWindowsPath(uri)); | 1135 String uri = request[4]; |
1136 try { | 1136 Uri resolvedUri = Uri.parse(_sanitizeWindowsPath(uri)); |
1137 if (resolvedUri.scheme == 'package') { | 1137 try { |
1138 resolvedUri = loaderState._resolvePackageUri(resolvedUri); | 1138 if (resolvedUri.scheme == 'package') { |
1139 } | 1139 resolvedUri = loaderState._resolvePackageUri(resolvedUri); |
1140 if (resolvedUri.scheme == '' || resolvedUri.scheme == 'file') { | 1140 } |
1141 resolvedUri = loaderState._workingDirectory.resolveUri(resolvedUri); | 1141 if (resolvedUri.scheme == '' || resolvedUri.scheme == 'file') { |
| 1142 resolvedUri = loaderState._workingDirectory.resolveUri(resolvedUri); |
| 1143 var msg = new List(5); |
| 1144 msg[0] = tag; |
| 1145 msg[1] = uri; |
| 1146 msg[2] = resolvedUri.toString(); |
| 1147 msg[3] = null; |
| 1148 msg[4] = resolvedUri.toFilePath(); |
| 1149 sp.send(msg); |
| 1150 } else { |
| 1151 throw "Cannot resolve scheme (${resolvedUri.scheme}) to file path" |
| 1152 " for $resolvedUri"; |
| 1153 } |
| 1154 } catch (e) { |
1142 var msg = new List(5); | 1155 var msg = new List(5); |
1143 msg[0] = tag; | 1156 msg[0] = -tag; |
1144 msg[1] = uri; | 1157 msg[1] = uri; |
1145 msg[2] = resolvedUri.toString(); | 1158 msg[2] = resolvedUri.toString(); |
1146 msg[3] = null; | 1159 msg[3] = null; |
1147 msg[4] = resolvedUri.toFilePath(); | 1160 msg[4] = e.toString(); |
1148 sp.send(msg); | 1161 sp.send(msg); |
1149 } else { | |
1150 throw "Cannot resolve scheme (${resolvedUri.scheme}) to file path" | |
1151 " for $resolvedUri"; | |
1152 } | 1162 } |
1153 } catch (e) { | 1163 }); |
1154 var msg = new List(5); | |
1155 msg[0] = -tag; | |
1156 msg[1] = uri; | |
1157 msg[2] = resolvedUri.toString(); | |
1158 msg[3] = null; | |
1159 msg[4] = e.toString(); | |
1160 sp.send(msg); | |
1161 } | |
1162 break; | 1164 break; |
1163 default: | 1165 default: |
1164 _log('Unknown loader request tag=$tag from $isolateId'); | 1166 _log('Unknown loader request tag=$tag from $isolateId'); |
1165 } | 1167 } |
1166 } | 1168 } |
OLD | NEW |