Commit bfeaaa8f authored by Nathan Kerr's avatar Nathan Kerr

Web paths should always replace \ with /

parent a9ef4e1f
...@@ -702,6 +702,13 @@ class AndroidDevice extends Device { ...@@ -702,6 +702,13 @@ class AndroidDevice extends Device {
return CryptoUtils.bytesToHex(sha1.close()); 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 @override
bool isAppInstalled(ApplicationPackage app) { bool isAppInstalled(ApplicationPackage app) {
if (!isConnected()) { if (!isConnected()) {
...@@ -775,7 +782,7 @@ class AndroidDevice extends Device { ...@@ -775,7 +782,7 @@ class AndroidDevice extends Device {
runCheckedSync([adbPath, 'reverse', serverPortString, serverPortString]); 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'; String url = 'http://localhost:$_serverPort/$relativeDartMain';
if (poke) { if (poke) {
url += '?rand=${new Random().nextDouble()}'; url += '?rand=${new Random().nextDouble()}';
...@@ -837,7 +844,7 @@ class AndroidDevice extends Device { ...@@ -837,7 +844,7 @@ class AndroidDevice extends Device {
//Split the columns by 1 or more spaces //Split the columns by 1 or more spaces
RegExp columnPattern = new RegExp('[ ]+'); RegExp columnPattern = new RegExp('[ ]+');
processes.forEach((String process){ processes.forEach((String process) {
if (process.contains(pattern)) { if (process.contains(pattern)) {
//The last column is the Process ID //The last column is the Process ID
String processId = process.split(columnPattern).last; String processId = process.split(columnPattern).last;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment