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

noreply at berlios.de noreply at berlios.de
Wed Sep 6 22:31:01 CEST 2006


Author: eppelman
Date: 2006-09-06 22:31:00 +0200 (Wed, 06 Sep 2006)
New Revision: 1567

Modified:
   izpack-src/trunk/src/lib/com/izforge/izpack/util/os/Shortcut.java
   izpack-src/trunk/src/lib/com/izforge/izpack/util/os/Unix_Shortcut.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 fields and attributes

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/util/os/Shortcut.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/util/os/Shortcut.java	2006-09-06 20:30:11 UTC (rev 1566)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/util/os/Shortcut.java	2006-09-06 20:31:00 UTC (rev 1567)
@@ -24,6 +24,8 @@
 import java.io.UnsupportedEncodingException;
 import java.util.Vector;
 
+import com.izforge.izpack.installer.UninstallData;
+
 /*---------------------------------------------------------------------------*/
 /**
  * This class represents a shortcut in a operating system independent way. OS specific subclasses
@@ -43,10 +45,13 @@
     // ------------------------------------------------------------------------
     /** APPLICATIONS = 1 */
     public static final int APPLICATIONS = 1;
+
     /** START_MENU = 2 */
     public static final int START_MENU = 2;
+
     /** DESKTOP = 3 */
     public static final int DESKTOP = 3;
+
     /** START_UP = 4 */
     public static final int START_UP = 4;
 
@@ -54,11 +59,11 @@
     public static final int HIDE = 0;
 
     /**
-     * NORMAL = 1
-     * Show the window 'normal' when starting. Usually restores the window properties at the last
-     * shut-down.
+     * NORMAL = 1 Show the window 'normal' when starting. Usually restores the window properties at
+     * the last shut-down.
      */
     public static final int NORMAL = 1;
+
     /** MINIMIZED = 2 */
     public static final int MINIMIZED = 2;
 
@@ -68,12 +73,15 @@
     /** CURRENT_USER = 1 (identifies the user type as the current user) */
     public static final int CURRENT_USER = 1;
 
-    /**  ALL_USERS = 2 (identifies the user type as valid for all users) */
+    /** ALL_USERS = 2 (identifies the user type as valid for all users) */
     public static final int ALL_USERS = 2;
 
-    /** indicates that this shortcut should be created for all users or only me **/
+    /** indicates that this shortcut should be created for all users or only me * */
     private Boolean createForAll;
 
+    /** internal field UninstallData uninstaller */
+    protected UninstallData uninstaller;
+
     /*--------------------------------------------------------------------------*/
     /**
      * This method initializes the object. It is used as a replacement for the contructor because of
@@ -336,7 +344,7 @@
      * </ul>
      * 
      * @exception IllegalArgumentException if an an invalid type is passed
-     * @throws UnsupportedEncodingException 
+     * @throws UnsupportedEncodingException
      */
     public void setLinkType(int type) throws IllegalArgumentException, UnsupportedEncodingException
     {
@@ -445,10 +453,19 @@
     }
 
     /**
-     * This sets the KdeSubstUID
+     * This sets the KdeUserName
      * 
-     * @param string
+     * @param string The UserName
      */
+    public void setKdeUserName(String string)
+    {
+    }
+
+    /**
+     * This sets the setKdeSubstUID
+     * 
+     * @param string exactly &quot;true&quot; or &quot;false&quot; or nothing
+     */
     public void setKdeSubstUID(String string)
     {
     }
@@ -462,40 +479,67 @@
     {
     }
 
-    /** 
-     * Gets the Programs Folder for the given User.     
-     * This is where to create subfolders or to place or create shortcuts.   
-     *
-     * @param current_user one of current or all 
-     *
+    /**
+     * Gets the Programs Folder for the given User. This is where to create subfolders or to place
+     * or create shortcuts.
+     * 
+     * @param current_user one of current or all
+     * 
      * @return The Foldername or null on unsupported platforms.
      */
-    public String getProgramsFolder( int current_user )
+    public String getProgramsFolder(int current_user)
     {
-      return null;
+        return null;
     }
 
-    /** 
-     * Sets the flag which indicates, that this should created for all. 
-     *
+    /**
+     * Sets the flag which indicates, that this should created for all.
+     * 
      * @param aCreateForAll A Flag - Set to true, if to create for All.
      */
-    public void setCreateForAll( Boolean aCreateForAll )
+    public void setCreateForAll(Boolean aCreateForAll)
     {
-      this.createForAll = Boolean.valueOf(aCreateForAll.booleanValue());
+        this.createForAll = Boolean.valueOf(aCreateForAll.booleanValue());
     }
 
-    /** 
+    /**
      * Gets the create for All Flag
-     *
+     * 
      * @return Returns True if this should be for all.
      */
-    public Boolean getCreateForAll(  )
+    public Boolean getCreateForAll()
     {
-      return createForAll;
+        return createForAll;
     }
-    
 
+    /**
+     * Sets the Categories Field On Unixes
+     * 
+     * @param theCategories the categories
+     */
+    public void setCategories(String theCategories)
+    {
+    }
+
+    /**
+     * Sets the TryExecField on Unixes.
+     * 
+     * @param aTryExec the try exec command
+     */
+    public void setTryExec(String aTryExec)
+    {
+    }
+
+    /**
+     * Sets the Uninstaller field with the unique Uninstaller Instance.
+     * 
+     * @param theUninstaller the unique instance
+     */
+    public void setUninstaller(UninstallData theUninstaller)
+    {
+        uninstaller = theUninstaller;
+    }
+
 }
 /*---------------------------------------------------------------------------*/
 

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/util/os/Unix_Shortcut.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/util/os/Unix_Shortcut.java	2006-09-06 20:30:11 UTC (rev 1566)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/util/os/Unix_Shortcut.java	2006-09-06 20:31:00 UTC (rev 1567)
@@ -1,17 +1,17 @@
 /*
  * IzPack - Copyright 2001-2006 Julien Ponge, All Rights Reserved.
- * 
+ *
  * http://www.izforge.com/izpack/
  * http://developer.berlios.de/projects/izpack/
- * 
+ *
  * Copyright 2003 Marc Eppelmann
- * 
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *     http://www.apache.org/licenses/LICENSE-2.0
- *     
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,7 @@
  * "Desktop Entry Standard"
  *  "The format of .desktop files, supported by KDE and GNOME."
  *  http://www.freedesktop.org/standards/desktop-entry-spec/
- * 
+ *
  *  [Desktop Entry]
  //  Comment=$Comment
  //  Comment[de]=
@@ -50,32 +50,41 @@
  */
 package com.izforge.izpack.util.os;
 
+import com.izforge.izpack.uninstaller.Uninstaller;
+import com.izforge.izpack.util.Debug;
+import com.izforge.izpack.util.FileExecutor;
+import com.izforge.izpack.util.OsVersion;
+import com.izforge.izpack.util.StringTool;
+import com.izforge.izpack.util.os.unix.ShellScript;
+import com.izforge.izpack.util.os.unix.UnixHelper;
+import com.izforge.izpack.util.os.unix.UnixUser;
+import com.izforge.izpack.util.os.unix.UnixUsers;
+
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
+
+import java.util.ArrayList;
 import java.util.Enumeration;
 import java.util.Properties;
 import java.util.StringTokenizer;
 import java.util.Vector;
 
-import com.izforge.izpack.util.FileExecutor;
-import com.izforge.izpack.util.OsVersion;
-import com.izforge.izpack.util.StringTool;
-
 /**
  * This is the Implementation of the RFC-Based Desktop-Link. Used in KDE and GNOME.
  * 
- * @author marc.eppelmann&#064;reddot.des
+ * @author marc.eppelmann&#064;reddot.de
  */
 public class Unix_Shortcut extends Shortcut implements Unix_ShortcutConstants
 {
 
-    //~ Static fields/initializers
+    // ~ Static fields/initializers *********************************************************
+
+    // ~ Static fields/initializers
     // *******************************************************************************************************************************
-
     /** version = "$Id$" */
     private static String version = "$Id$";
 
@@ -99,13 +108,14 @@
 
     /** C = Comment = H+S = "# " */
     private final static String C = H + S;
-    
+
     /** QM = "\"" : <b>Q</b>uotation<b>M</b>ark */
     private final static String QM = "\"";
 
-    //~ Instance fields
+    // ~ Instance fields ********************************************************************
+
+    // ~ Instance fields
     // ******************************************************************************************************************************************
-
     /** internal String createdDirectory */
     private String createdDirectory;
 
@@ -127,28 +137,40 @@
     /** internal Properties Set */
     private Properties props;
 
-    /** forAll = new Boolean(false): A flag to indicate that this should created for all users. */
+    /**
+     * forAll = new Boolean(false): A flag to indicate that this should created for all users.
+     */
     private Boolean forAll = Boolean.FALSE;
 
-    //~ Constructors
+    /** DOCUMENT ME! */
+    public StringBuffer hlp;
+
+    // ~ Constructors ***********************************************************************
+
+    // ~ Constructors
     // *********************************************************************************************************************************************
-
     /**
      * Creates a new Unix_Shortcut object.
      */
     public Unix_Shortcut()
     {
-        StringBuffer hlp = new StringBuffer();
+        hlp = new StringBuffer();
 
         String userLanguage = System.getProperty("user.language", "en");
 
         hlp.append("[Desktop Entry]" + N);
+        
+        // TODO implement Attribute: X-KDE-StartupNotify=true
 
+        hlp.append("Categories=" + $Categories + N);
+
         hlp.append("Comment=" + $Comment + N);
         hlp.append("Comment[").append(userLanguage).append("]=" + $Comment + N);
         hlp.append("Encoding=" + $Encoding + N);
-        
-        hlp.append("Exec="+ $E_QUOT + $Exec + $E_QUOT + S + $Arguments + N);
+
+        hlp.append("TryExec=" + $TryExec + N);
+
+        hlp.append("Exec=" + $E_QUOT + $Exec + $E_QUOT + S + $Arguments + N);
         hlp.append("GenericName=" + $GenericName + N);
 
         hlp.append("GenericName[").append(userLanguage).append("]=" + $GenericName + N);
@@ -157,7 +179,7 @@
         hlp.append("Name=" + $Name + N);
         hlp.append("Name[").append(userLanguage).append("]=" + $Name + N);
 
-        hlp.append("Path="+ $P_QUOT + $Path + $P_QUOT + N);
+        hlp.append("Path=" + $P_QUOT + $Path + $P_QUOT + N);
         hlp.append("ServiceTypes=" + $ServiceTypes + N);
         hlp.append("SwallowExec=" + $SwallowExec + N);
         hlp.append("SwallowTitle=" + $SwallowTitle + N);
@@ -169,7 +191,8 @@
         hlp.append("X-KDE-SubstituteUID=" + $X_KDE_SubstituteUID + N);
         hlp.append("X-KDE-Username=" + $X_KDE_Username + N);
         hlp.append(N);
-        hlp.append(C + "created by" + S).append(getClass().getName()).append(S).append(rev).append(N);
+        hlp.append(C + "created by" + S).append(getClass().getName()).append(S).append(rev).append(
+                N);
         hlp.append(C).append(version);
 
         template = hlp.toString();
@@ -179,18 +202,20 @@
         initProps();
     }
 
-    //~ Methods
+    // ~ Methods ****************************************************************************
+
+    // ~ Methods
     // **************************************************************************************************************************************************
-
     /**
-     * This initialisizes all Properties Values with null.
+     * This initialisizes all Properties Values with &quot;&quot;.
      */
     private void initProps()
     {
         String[] propsArray = { $Comment, $$LANG_Comment, $Encoding, $Exec, $Arguments,
                 $GenericName, $$LANG_GenericName, $MimeType, $Name, $$LANG_Name, $Path,
                 $ServiceTypes, $SwallowExec, $SwallowTitle, $Terminal, $Options_For_Terminal,
-                $Type, $X_KDE_SubstituteUID, $X_KDE_Username, $Icon, $URL, $E_QUOT, $P_QUOT };
+                $Type, $X_KDE_SubstituteUID, $X_KDE_Username, $Icon, $URL, $E_QUOT, $P_QUOT,
+                $Categories, $TryExec};
 
         for (int i = 0; i < propsArray.length; i++)
         {
@@ -205,7 +230,6 @@
      */
     public void initialize(int aType, String aName) throws Exception
     {
-        int itsType = aType;
         this.itsName = aName;
         props.put($Name, aName);
     }
@@ -227,7 +251,7 @@
      */
     public String getDirectoryCreated()
     {
-        return this.createdDirectory; //while not stored...
+        return this.createdDirectory; // while not stored...
     }
 
     /**
@@ -353,6 +377,7 @@
         {
             result = new File(System.getProperty("user.home") + File.separator + ".kde");
         }
+
         return result;
     }
 
@@ -383,69 +408,174 @@
 
         boolean rootUser4All = this.getUserType() == Shortcut.ALL_USERS;
         boolean create4All = this.getCreateForAll().booleanValue();
-        
-        if ("".equals(this.itsGroupName) && this.getLinkType() == Shortcut.DESKTOP)
+
+        // Create The Desktop Shortcuts
+        if ("".equals(this.itsGroupName) && (this.getLinkType() == Shortcut.DESKTOP))
         {
             target = System.getProperty("user.home") + FS + "Desktop" + FS + this.itsName
                     + DESKTOP_EXT;
             this.itsFileName = target;
 
-            File source = writeShortCut(target, shortCutDef);
+            // write my own ShortCut
+            File writtenDesktopFile = writeShortCut(target, shortCutDef);
 
+            // If I'm root and this Desktop.ShortCut should be for all other users
             if (rootUser4All && create4All)
             {
                 File dest = null;
-                File[] userHomesList = new File(FS + "home" + FS).listFiles();
 
-                File aHomePath = null;
+                // Create a tempFileName of this ShortCut
+                File tempFile = File.createTempFile(this.getClass().getName(), Long.toString(System
+                        .currentTimeMillis())
+                        + ".tmp");
 
-                if (userHomesList != null)
+                copyTo(writtenDesktopFile, tempFile);
+
+                Debug.log("Wrote Tempfile: " + tempFile.toString());
+
+                String chmod = UnixHelper.getCustomCommand("chmod");
+                String chown = UnixHelper.getCustomCommand("chown");
+                String copy = UnixHelper.getCpCommand();
+                String su = UnixHelper.getSuCommand();
+
+                FileExecutor.getExecOutput(new String[] { chmod, "uga+rwx", tempFile.toString()});
+
+                // su marc.eppelmann -c "/bin/cp /home/marc.eppelmann/backup.job.out.txt
+                // /home/marc.eppelmann/backup.job.out2.txt"
+                ArrayList users = UnixUsers.getUsersWithValidShellsExistingHomesAndDesktops();
+
+                for (int idx = 0; idx < users.size(); idx++)
                 {
-                    for (int idx = 0; idx < userHomesList.length; idx++)
+                    UnixUser user = ((UnixUser) users.get(idx));
+
+                    try
                     {
-                        if (userHomesList[idx].isDirectory())
-                        {
+                        // aHomePath = userHomesList[idx];
+                        dest = new File(user.getHome() + FS + "Desktop" + FS
+                                + writtenDesktopFile.getName());
+                        //
+                        // I'm root and cannot write into Users Home as root;
+                        // But I'm Root and I can slip in every users skin :-)
+                        // 
+                        // by# su username
+                        //
+                        // This works as well
+                        // su username -c "cp /tmp/desktopfile $HOME/Desktop/link.desktop"
+                        //
+                        // copyTo(writtenDesktopFile, dest);
+                        Debug.log("Will Copy: " + tempFile.toString() + " to " + dest.toString());
 
-                            try
-                            {
-                                aHomePath = userHomesList[idx];
-                                dest = new File(aHomePath.toString() + FS + "Desktop" + FS
-                                        + source.getName());
+                        StringBuffer script = new StringBuffer();
 
-                                copyTo(source, dest);
-                            }
-                            catch (Exception rex)
-                            {
-                                /* ignore */// most distros does not allow root to access any user
-                                          // home (ls -la /home/user drwx------)
-                                // But try it anyway...
-                            }
+                        script.append(su);
+                        script.append(S);
+                        script.append(user.getName());
+                        script.append(S);
+                        script.append("-c");
+                        script.append(S);
+                        script.append('"');
+                        script.append(copy);
+                        script.append(S);
+                        script.append(tempFile.toString());
+                        script.append(S);
+                        script.append(dest.toString());
+                        script.append('"');
 
-                            try
-                            {
-                                String[] output = new String[2];
-                                FileExecutor fe = new FileExecutor();
-                                int result = fe.executeCommand(new String[] { "/bin/chown",
-                                        aHomePath.getName(), aHomePath.toString()}, output);
-                                if (result != 0)
-                                {}
-                            }
-                            catch (RuntimeException rexx)
-                            {}
+                        Debug.log("Executes: " + script.toString());
+
+                        String result = ShellScript.execAndDelete(script, File.createTempFile(
+                                this.getClass().getName(),
+                                Long.toString(System.currentTimeMillis()) + ".sh").toString());
+
+                        Debug.log("Result: " + result);
+
+                        uninstaller.addRootAsUserFile(dest.toString(), user);
+
+                        /*
+                         * FileExecutor.getExecOutput(new String[] { su, user.getName(), "-c", "\"" +
+                         * copy + " " + tempFile.toString() + " " + dest.toString() + "\""});
+                         */
+                        Debug.log("Copied: " + tempFile.toString() + " to " + dest.toString());
+                        
+                        try
+                        {
+                            FileExecutor.getExecOutput(new String[] { chown, user.getName(),
+                                    dest.toString()});
                         }
+                        catch (RuntimeException rexx)
+                        {
+                            System.out.println("While Chown :" + rexx.getLocalizedMessage());
+                            rexx.printStackTrace();
+                        }
                     }
+                    catch (Exception rex)
+                    {
+                        System.out.println("While Su Copy:" + rex.getLocalizedMessage());
+                        rex.printStackTrace();
+
+                        /* ignore */
+                        // most distros does not allow root to access any user
+                        // home (ls -la /home/user drwx------)
+                        // But try it anyway...
+                    }
+
+                    
                 }
+                try
+                {
+                    tempFile.delete();
+                }
+                catch (Exception e)
+                {
+                    tempFile.deleteOnExit();
+                }
             }
         }
+
+        // This is - or should be only a Link in the [K?]-Menu
         else
         {
             File kdeHomeShareApplnk = getKdeShareApplnkFolder(this.getUserType());
             target = kdeHomeShareApplnk.toString() + FS + this.itsGroupName + FS + this.itsName
                     + DESKTOP_EXT;
             this.itsFileName = target;
+            writeShortCut(target, shortCutDef);
+            
+            if (rootUser4All)
+            {
+                if (create4All)
+                {
+                    // write the icon pixmaps into /usr/share/pixmaps
+                    
+                    File theIcon = new File( this.getIconLocation() );
+                    File commonIcon = new File( "/usr/share/pixmaps/" + theIcon.getName() );
+                    
+                    try
+                    {
+                      copyTo( theIcon, commonIcon  );
+                      uninstaller.addFile(commonIcon.toString());
+                    }
+                    catch(Exception cnc)
+                    {
+                        Debug.log("Could Not Copy: " + theIcon + " to " + commonIcon + "( "+ cnc.getMessage() +" )" );                        
+                    }
 
-            if (rootUser4All && !create4All) { return; }
-            writeShortCut(target, shortCutDef);
+                    // write *.desktop.file into /usr/share/applications
+
+                    String commonTarget = "/usr/share/applications/" + this.itsName
+                    + DESKTOP_EXT;
+                    this.itsFileName = target;
+                    File writtenFile = writeShortCut(commonTarget, shortCutDef);
+                    
+                    uninstaller.addFile(writtenFile.toString());
+                      
+                }
+                else
+                {
+                    // do nothing
+                }
+            }
+            
         }
     }
 
@@ -477,18 +607,16 @@
     }
 
     /**
-     * Writes the given Shortcutdefinition to the given Target.
-     * Returns the written File.  
+     * Writes the given Shortcutdefinition to the given Target. Returns the written File.
      * 
      * @param target
      * @param shortCutDef
      * 
-     * @return the File of the written shortcut. 
+     * @return the File of the written shortcut.
      */
     private File writeShortCut(String target, String shortCutDef)
     {
-        File targetPath = new File(target.substring(0,
-                target.lastIndexOf(File.separatorChar)));
+        File targetPath = new File(target.substring(0, target.lastIndexOf(File.separatorChar)));
 
         if (!targetPath.exists())
         {
@@ -496,30 +624,34 @@
             this.createdDirectory = targetPath.toString();
         }
 
-        File targetFileName = new File( target );
-        File backupFile = new File( targetPath + File.separator + "." + targetFileName.getName() + System.currentTimeMillis() );
-        if( targetFileName.exists() )
+        File targetFileName = new File(target);
+        File backupFile = new File(targetPath + File.separator + "." + targetFileName.getName()
+                + System.currentTimeMillis());
+
+        if (targetFileName.exists())
         {
-          try
-          {
-            // create a hidden backup.file of the existing shortcut with a timestamp name.           
-            copyTo( targetFileName, backupFile  );// + System.e );
-            targetFileName.delete();
-          }
-          catch (IOException e3)
-          {
-            System.out.println("cannot create backup file " + backupFile + " of " + targetFileName );//  e3.printStackTrace();
-          }
+            try
+            {
+                // create a hidden backup.file of the existing shortcut with a timestamp name.
+                copyTo(targetFileName, backupFile); // + System.e );
+                targetFileName.delete();
+            }
+            catch (IOException e3)
+            {
+                System.out.println("cannot create backup file " + backupFile + " of "
+                        + targetFileName); // e3.printStackTrace();
+            }
         }
+
         FileWriter fileWriter = null;
 
         try
         {
-            fileWriter = new FileWriter( targetFileName );
+            fileWriter = new FileWriter(targetFileName);
         }
         catch (IOException e1)
         {
-            System.out.println( e1.getMessage() );
+            System.out.println(e1.getMessage());
         }
 
         try
@@ -550,7 +682,6 @@
      */
     public void setArguments(String args)
     {
-        String itsArguments = args;
         props.put($Arguments, args);
     }
 
@@ -561,7 +692,6 @@
      */
     public void setDescription(String description)
     {
-        String itsDescription = description;
         props.put($Comment, description);
     }
 
@@ -572,11 +702,7 @@
      */
     public void setIconLocation(String path, int index)
     {
-        String itsIconPath = path;
-        int itsIconIndex = index;
         props.put($Icon, path);
-
-        //
     }
 
     /**
@@ -597,7 +723,6 @@
      */
     public void setLinkType(int aType) throws IllegalArgumentException
     {
-        int itsType = aType;
     }
 
     /**
@@ -617,7 +742,6 @@
      */
     public void setShowCommand(int show)
     {
-        int itsShow = show;
     }
 
     /**
@@ -627,13 +751,13 @@
      */
     public void setTargetPath(String aPath)
     {
-        String itsTargetPath = aPath;
-        
-        StringTokenizer whiteSpaceTester = new StringTokenizer( aPath );
-        
-        if( whiteSpaceTester.countTokens() > 1 )
-          props.put( $E_QUOT,QM );
+        StringTokenizer whiteSpaceTester = new StringTokenizer(aPath);
 
+        if (whiteSpaceTester.countTokens() > 1)
+        {
+            props.put($E_QUOT, QM);
+        }
+
         props.put($Exec, aPath);
     }
 
@@ -654,13 +778,13 @@
      */
     public void setWorkingDirectory(String aDirectory)
     {
-        String itsWorkingDirectory = aDirectory;
-        
-        StringTokenizer whiteSpaceTester = new StringTokenizer( aDirectory );
-        
-        if( whiteSpaceTester.countTokens() > 1 )
-          props.put( $P_QUOT,QM );
+        StringTokenizer whiteSpaceTester = new StringTokenizer(aDirectory);
 
+        if (whiteSpaceTester.countTokens() > 1)
+        {
+            props.put($P_QUOT, QM);
+        }
+
         props.put($Path, aDirectory);
     }
 
@@ -762,12 +886,22 @@
      * 
      * @see com.izforge.izpack.util.os.Shortcut#setKdeSubstUID(java.lang.String)
      */
-    public void setKdeSubstUID(String aKDESubstUID)
+    public void setKdeSubstUID(String trueFalseOrNothing)
     {
-        props.put($X_KDE_SubstituteUID, aKDESubstUID);
+        props.put($X_KDE_SubstituteUID, trueFalseOrNothing);
     }
 
     /**
+     * Sets The KDE Specific subst UID property
+     * 
+     * @see com.izforge.izpack.util.os.Shortcut#setKdeSubstUID(java.lang.String)
+     */
+    public void setKdeUserName(String aUserName)
+    {
+        props.put($X_KDE_Username, aUserName);
+    }
+
+    /**
      * Sets the MimeType
      * 
      * @see com.izforge.izpack.util.os.Shortcut#setMimetype(java.lang.String)
@@ -826,4 +960,25 @@
     {
         return itsUserType;
     }
+
+    /**
+     * Sets the Categories Field
+     * 
+     * @param theCategories the categories
+     */
+    public void setCategories(String theCategories)
+    {
+        props.put($Categories, theCategories);
+    }
+
+    /**
+     * Sets the TryExecField.
+     * 
+     * @param aTryExec the try exec command
+     */
+    public void setTryExec(String aTryExec)
+    {
+        props.put($TryExec, aTryExec);
+    }
+
 }




More information about the izpack-changes mailing list