HelperClass: runProcess() can accept directory
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Fri, 12 Jun 2015 04:36:47 +0000 (13:36 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Fri, 12 Jun 2015 08:30:33 +0000 (17:30 +0900)
Change-Id: Ibc1f759324b9f072c1b2ba26c2461bc21b99f60c
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
src/org/tizen/emulator/manager/vms/helper/HelperClass.java

index f42c962..a2c55b1 100644 (file)
@@ -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<String> cmd) {
+               return runProcess(cmd, null);
+       }
+
+       public static ProcessResult runProcess(List<String> 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<String> stdOut = ProcessOutputReader.readStdOut(process, cmd.toString());