[izpack-changes] r1566 - izpack-src/trunk/src/lib/com/izforge/izpack/util

noreply at berlios.de noreply at berlios.de
Wed Sep 6 22:30:12 CEST 2006


Author: eppelman
Date: 2006-09-06 22:30:11 +0200 (Wed, 06 Sep 2006)
New Revision: 1566

Modified:
   izpack-src/trunk/src/lib/com/izforge/izpack/util/FileExecutor.java
Log:
-implemented  the X-KDE subsitute user - shortcut attribute (see Unix_shortcutSpec.xml).
-write Desktop shortcuts to all known local and ypbinded users "desktop" folders.
-write common shortcuts  to the new freedesktop.org common "/usr/share/applications" 
and "/usr/share/pixmaps" folders to display these in the commons [start].menu
Here: added new static method for immediate exec()

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/util/FileExecutor.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/util/FileExecutor.java	2006-09-06 20:28:42 UTC (rev 1565)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/util/FileExecutor.java	2006-09-06 20:30:11 UTC (rev 1566)
@@ -137,6 +137,43 @@
     }
 
     /**
+     * Gets the output of the given (console based) commandline
+     * 
+     * @param aCommandLine to execute
+     * @return the result of the command
+     */
+    public static String getExecOutput(String[] aCommandLine)
+    {
+        return getExecOutput(aCommandLine, false);
+
+    }
+
+    /**
+     * Executes the given Command and gets the result of StdOut, or if exec returns !=0:  StdErr.
+     * 
+     * @param aCommandLine aCommandLine to execute
+     * @param forceToGetStdOut if true returns stdout
+     * @return the result of the command stdout or stderr if exec returns !=0
+     */
+    public static String getExecOutput(String[] aCommandLine, boolean forceToGetStdOut)
+    {
+        FileExecutor fe = new FileExecutor();
+
+        String[] execOut = new String[2];
+
+        int execResult = fe.executeCommand(aCommandLine, execOut);
+
+        if (execResult == 0)
+
+            return execOut[0];
+
+        else if (forceToGetStdOut == true)
+            return execOut[0];
+        else
+            return execOut[1];
+    }
+
+    /**
      * Executed a system command and waits for completion.
      * 
      * @param params system command as string array




More information about the izpack-changes mailing list