From bfeaaa8fb78831901019e513631f122867521aa3 Mon Sep 17 00:00:00 2001 From: Nathan Kerr Date: Fri, 23 Oct 2015 13:34:39 -0700 Subject: [PATCH] Web paths should always replace \ with / --- packages/flutter_tools/lib/src/device.dart | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/flutter_tools/lib/src/device.dart b/packages/flutter_tools/lib/src/device.dart index 02a1a417f3..19ab6cdd26 100644 --- a/packages/flutter_tools/lib/src/device.dart +++ b/packages/flutter_tools/lib/src/device.dart @@ -702,6 +702,13 @@ class AndroidDevice extends Device { return CryptoUtils.bytesToHex(sha1.close()); } + /** + * Since Window's paths have backslashes, we need to convert those to forward slashes to make a valid URL + */ + String _convertToURL(String path) { + return path.replaceAll('\\', '/'); + } + @override bool isAppInstalled(ApplicationPackage app) { if (!isConnected()) { @@ -775,7 +782,7 @@ class AndroidDevice extends Device { runCheckedSync([adbPath, 'reverse', serverPortString, serverPortString]); } - String relativeDartMain = path.relative(mainDart, from: serverRoot); + String relativeDartMain = _convertToURL(path.relative(mainDart, from: serverRoot)); String url = 'http://localhost:$_serverPort/$relativeDartMain'; if (poke) { url += '?rand=${new Random().nextDouble()}'; @@ -837,7 +844,7 @@ class AndroidDevice extends Device { //Split the columns by 1 or more spaces RegExp columnPattern = new RegExp('[ ]+'); - processes.forEach((String process){ + processes.forEach((String process) { if (process.contains(pattern)) { //The last column is the Process ID String processId = process.split(columnPattern).last;