Skip to content

Commit 62d5626

Browse files
committed
ViewClient: Added .bat to monkeyrunner for you know what OS
1 parent 5a39b8c commit 62d5626

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

AndroidViewClient/src/com/dtmilano/android/viewclient/ViewClient.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,11 +189,10 @@ public int execute() throws IOException, InterruptedException {
189189
cmdList.add(mJar.getName());
190190
}
191191
else {
192-
final String os = System.getProperty("os.name");
193-
if (os.toUpperCase().contains("WINDOWS")) {
192+
if (isWindows()) {
194193
fatal(String.format(
195194
"%s was not found and %s does not support shebang in scripts. Aborting.",
196-
MONKEYRUNNER, os));
195+
MONKEYRUNNER, System.getProperty("os.name")));
197196
}
198197
}
199198
cmdList.add(mDest.getAbsolutePath());
@@ -226,6 +225,14 @@ public int execute() throws IOException, InterruptedException {
226225
throw new RuntimeException("Couldn't create process");
227226
}
228227

228+
/**
229+
* @return
230+
*/
231+
private static boolean isWindows() {
232+
final String os = System.getProperty("os.name");
233+
return os.toUpperCase().contains("WINDOWS");
234+
}
235+
229236
/**
230237
* Locates <code>monkeyrunner</code> executable in path.
231238
*
@@ -237,7 +244,10 @@ private static String locateMonkeyRunner() {
237244
File.pathSeparator);
238245
while (tokenizer.hasMoreTokens()) {
239246
final String dir = tokenizer.nextToken();
240-
File monkeyrunner = new File(dir + File.separator + MONKEYRUNNER);
247+
File monkeyrunner = new File(dir + File.separator + MONKEYRUNNER + (isWindows() ? ".bat" : ""));
248+
if (DEBUG) {
249+
System.err.println("searching for " + monkeyrunner + " exist? " + monkeyrunner.exists());
250+
}
241251
if (monkeyrunner.exists()) {
242252
return monkeyrunner.getAbsolutePath();
243253
}

0 commit comments

Comments
 (0)