Enable Hot Restart on Windows (#8548)
diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart
index ec2e3e0..1e9b369 100644
--- a/packages/flutter_tools/lib/src/run_hot.dart
+++ b/packages/flutter_tools/lib/src/run_hot.dart
@@ -313,25 +313,23 @@
_devFS = null;
}
- Future<Null> _launchInView(String entryPath,
- String packagesPath,
- String assetsDirectoryPath) async {
+ Future<Null> _launchInView(Uri entryUri,
+ Uri packagesUri,
+ Uri assetsDirectoryUri) async {
FlutterView view = vmService.vm.mainView;
- return view.runFromSource(entryPath, packagesPath, assetsDirectoryPath);
+ return view.runFromSource(entryUri, packagesUri, assetsDirectoryUri);
}
Future<Null> _launchFromDevFS(ApplicationPackage package,
String mainScript) async {
- String entryPath = fs.path.relative(mainScript, from: projectRootPath);
- String deviceEntryPath =
- _devFS.baseUri.resolve(entryPath).toFilePath();
- String devicePackagesPath =
- _devFS.baseUri.resolve('.packages').toFilePath();
- String deviceAssetsDirectoryPath =
- _devFS.baseUri.resolve(getAssetBuildDirectory()).toFilePath();
- await _launchInView(deviceEntryPath,
- devicePackagesPath,
- deviceAssetsDirectoryPath);
+ String entryUri = fs.path.relative(mainScript, from: projectRootPath);
+ Uri deviceEntryUri = _devFS.baseUri.resolveUri(fs.path.toUri(entryUri));
+ Uri devicePackagesUri = _devFS.baseUri.resolve('.packages');
+ Uri deviceAssetsDirectoryUri =
+ _devFS.baseUri.resolveUri(fs.path.toUri(getAssetBuildDirectory()));
+ await _launchInView(deviceEntryUri,
+ devicePackagesUri,
+ deviceAssetsDirectoryUri);
}
Future<OperationResult> _restartFromSources() async {
diff --git a/packages/flutter_tools/lib/src/vmservice.dart b/packages/flutter_tools/lib/src/vmservice.dart
index 764196c..4355164 100644
--- a/packages/flutter_tools/lib/src/vmservice.dart
+++ b/packages/flutter_tools/lib/src/vmservice.dart
@@ -710,15 +710,16 @@
}
Future<ServiceMap> runInView(String viewId,
- String main,
- String packages,
- String assetsDirectory) {
+ Uri main,
+ Uri packages,
+ Uri assetsDirectory) {
+ // TODO(goderbauer): Transfer Uri (instead of file path) when remote end supports it.
return invokeRpc('_flutter.runInView',
params: <String, dynamic> {
'viewId': viewId,
- 'mainScript': main,
- 'packagesFile': packages,
- 'assetDirectory': assetsDirectory
+ 'mainScript': main.toFilePath(windows: false),
+ 'packagesFile': packages.toFilePath(windows: false),
+ 'assetDirectory': assetsDirectory.toFilePath(windows: false)
});
}
@@ -1024,9 +1025,9 @@
}
// TODO(johnmccutchan): Report errors when running failed.
- Future<Null> runFromSource(String entryPath,
- String packagesPath,
- String assetsDirectoryPath) async {
+ Future<Null> runFromSource(Uri entryUri,
+ Uri packagesUri,
+ Uri assetsDirectoryUri) async {
final String viewId = id;
// When this completer completes the isolate is running.
final Completer<Null> completer = new Completer<Null>();
@@ -1040,9 +1041,9 @@
}
});
await owner.vm.runInView(viewId,
- entryPath,
- packagesPath,
- assetsDirectoryPath);
+ entryUri,
+ packagesUri,
+ assetsDirectoryUri);
await completer.future;
await owner.vm.refreshViews();
await subscription.cancel();