Possibility to configure terminal emulator.
[instantlauncher.git] / src / main / java / eu / svjatoslav / instantlauncher / Utils.java
index 297f010..506feaa 100755 (executable)
@@ -19,19 +19,24 @@ public class Utils {
     }
 
     public static void runOpeningApplication(String commands, final File file) {
-        runOpeningApplication(commands.split("\\s+"), file);
-    }
+        try {
+            String[] commandsArray = commands.split("\\s+");
+            for (int i=0; i< commandsArray.length; i++)
+                commandsArray[i] = commandsArray[i].replaceAll("\\{file\\}", file.getAbsolutePath());
 
-    private static void runOpeningApplication(final String[] commands, final File file) {
-        for (int i = 0; i < commands.length; i++)
-            if (commands[i].equals(FILE_INDICATOR))
-                commands[i] = file.getAbsolutePath();
+            Runtime.getRuntime().exec(commandsArray);
+        } catch (final IOException e) {
+            new ExceptionDialog(e);
+        }
+    }
 
+    public static void executeCommand(String... c) {
         try {
-            Runtime.getRuntime().exec(commands);
+            Runtime.getRuntime().exec(c);
         } catch (final IOException e) {
             new ExceptionDialog(e);
         }
     }
 
+
 }