From 970e312fd1abc89c0a1952f66718a1da368bbf8d Mon Sep 17 00:00:00 2001 From: SeokYeon Hwang Date: Fri, 12 Jun 2015 13:36:47 +0900 Subject: [PATCH] HelperClass: runProcess() can accept directory Change-Id: Ibc1f759324b9f072c1b2ba26c2461bc21b99f60c Signed-off-by: SeokYeon Hwang --- .../emulator/manager/vms/helper/HelperClass.java | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/org/tizen/emulator/manager/vms/helper/HelperClass.java b/src/org/tizen/emulator/manager/vms/helper/HelperClass.java index f42c962..a2c55b1 100644 --- a/src/org/tizen/emulator/manager/vms/helper/HelperClass.java +++ b/src/org/tizen/emulator/manager/vms/helper/HelperClass.java @@ -54,9 +54,9 @@ public class HelperClass { public static boolean checkString(String t) { for(char ch : t.toCharArray()) { - if((ch >= 'a' && ch <= 'z') || - (ch >= 'A' && ch <= 'Z') || - (ch >='0' && ch <= '9') || + if((ch >= 'a' && ch <= 'z') || + (ch >= 'A' && ch <= 'Z') || + (ch >='0' && ch <= '9') || (ch == '-') || (ch == '_')) { continue; } else { @@ -72,7 +72,7 @@ public class HelperClass { isWindows = true; t = t.toLowerCase(); } - VMProperty[] properties = (VMProperty[])EmulatorVMList.getInstance().getProperties(); + VMProperty[] properties = EmulatorVMList.getInstance().getProperties(); for (VMProperty p : properties) { if (isWindows ) { if (p.getName().toLowerCase().equals(t)) { @@ -143,7 +143,7 @@ public class HelperClass { layout.marginRight = 0; layout.marginTop = 0; layout.marginWidth = 0; - + return layout; } */ @@ -228,12 +228,20 @@ public class HelperClass { } } - public static ProcessResult runProcess(List cmd) { + return runProcess(cmd, null); + } + + public static ProcessResult runProcess(List cmd, File directory) { ProcessResult result = new ProcessResult(); ProcessBuilder pb = new ProcessBuilder(cmd); int exitValue = 0; - Process process; + Process process = null; + + if (directory != null) { + pb.directory(directory); + } + try { process = pb.start(); List stdOut = ProcessOutputReader.readStdOut(process, cmd.toString()); -- 2.7.4