[izpack-changes] r1742 - in izpack-src/trunk: . src/lib/com/izforge/izpack/installer src/lib/com/izforge/izpack/panels src/lib/com/izforge/izpack/util/os
noreply at berlios.de
noreply at berlios.de
Sat Feb 17 14:47:54 CET 2007
Author: jponge
Date: 2007-02-17 14:47:35 +0100 (Sat, 17 Feb 2007)
New Revision: 1742
Modified:
izpack-src/trunk/Versions.txt
izpack-src/trunk/src/lib/com/izforge/izpack/installer/UninstallData.java
izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java
izpack-src/trunk/src/lib/com/izforge/izpack/panels/PacksPanelBase.java
izpack-src/trunk/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
izpack-src/trunk/src/lib/com/izforge/izpack/util/os/Unix_Shortcut.java
Log:
Merged -r1723:1741 from branches/3.10
Modified: izpack-src/trunk/Versions.txt
===================================================================
--- izpack-src/trunk/Versions.txt 2007-02-17 13:38:23 UTC (rev 1741)
+++ izpack-src/trunk/Versions.txt 2007-02-17 13:47:35 UTC (rev 1742)
@@ -1,6 +1,7 @@
[ The list of the different public versions of IzPack ]
- > Next release
+ > Next major release
+
- Added ignore as possible value for failure argument in executables (Dennis Reil)
- Added Conditional expressions (Dennis Reil)
- Fixed selection of default language in LanguageSelectionDialog (Dennis Reil)
@@ -8,6 +9,14 @@
- Added corrupt volume detection (Dennis Reil)
- Added file and dir fields in UserInputPanel (Dennis Reil)
+ > 3.10.1 (build 2007.xx.xx)
+
+- Fixed NPE for pack.id == null (Fabrice Mirabile)
+- Packages that are not marked as preselected must also be removed from the selectedPacks
+ (Martina Angela Albrecht, via Fabrice Mirabile)
+- FreeDesktop XDG standard support for Gnome and KDE shortcuts support
+ (Vladimir Ralev via Julien Ponge)
+
> 3.10.0 (build 2007.01.29)
- Added docu: executeForPack, executeclass,logfiledir for ProcessPanel (Fabrice Mirabile)
Modified: izpack-src/trunk/src/lib/com/izforge/izpack/installer/UninstallData.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/installer/UninstallData.java 2007-02-17 13:38:23 UTC (rev 1741)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/installer/UninstallData.java 2007-02-17 13:47:35 UTC (rev 1742)
@@ -87,7 +87,8 @@
*/
public synchronized void addFile(String path)
{
- filesList.add(path);
+ if(path != null)
+ filesList.add(path);
}
/**
Modified: izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java 2007-02-17 13:38:23 UTC (rev 1741)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/panels/InstallationGroupPanel.java 2007-02-17 13:47:35 UTC (rev 1742)
@@ -271,7 +271,7 @@
while( iter.hasNext() )
{
Pack p = (Pack) iter.next();
- if( data.packNames.contains(p.name) == false )
+ if( data.packNames.contains(p.name) == false || !p.preselected)
{
iter.remove();
Debug.trace("Removed selectedPack: "+p.name);
Modified: izpack-src/trunk/src/lib/com/izforge/izpack/panels/PacksPanelBase.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/panels/PacksPanelBase.java 2007-02-17 13:38:23 UTC (rev 1741)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/panels/PacksPanelBase.java 2007-02-17 13:47:35 UTC (rev 1742)
@@ -357,7 +357,7 @@
{
packName = langpack.getString(key);
}
- if ("".equals(packName) || key.equals(packName))
+ if ("".equals(packName) || key.equals(packName) || pack.id == null)
{
packName = pack.name;
}
Modified: izpack-src/trunk/src/lib/com/izforge/izpack/panels/ShortcutPanel.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/panels/ShortcutPanel.java 2007-02-17 13:38:23 UTC (rev 1741)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/panels/ShortcutPanel.java 2007-02-17 13:47:35 UTC (rev 1742)
@@ -1108,7 +1108,7 @@
*/
return true; // If there is no Condition defined, just create the shortcut.
}
-
+
/*--------------------------------------------------------------------------*/
/**
@@ -1121,6 +1121,28 @@
addToUninstaller();
}
+ private String createGnomeMenu(Vector shortcuts, String menuName)
+ {
+ String menuConfigText = "<Menu>\n" +
+ "<Name>Applications</Name>\n" +
+ "<Menu>\n" +
+ "<Name>" + menuName + "</Name>\n" +
+ "<Include>\n";
+
+ ShortcutData data;
+
+ for (int i = 0; i < shortcuts.size(); i++)
+ {
+ data = (ShortcutData) shortcuts.elementAt(i);
+ menuConfigText += "<Filename>" + data.name + ".desktop</Filename>\n";
+ }
+ menuConfigText += "</Include>\n</Menu>\n</Menu>";
+ return menuConfigText;
+
+ }
+
+ /*--------------------------------------------------------------------------*/
+
/**
* Creates all shortcuts based on the information in shortcuts.
*/
@@ -1134,7 +1156,32 @@
//fix: don't influence other shortcuts when altering group name...
String gn = groupName;
+
+ if(OsVersion.IS_UNIX)
+ {
+ String menuFile = createGnomeMenu(shortcuts, groupName);
+ String menuFolder = System.getProperty("user.home") + File.separator
+ + ".config/menus/applications-merged/";
+ File menuConfigFolder = new File(menuFolder);
+ String menuFilePath = menuFolder + groupName + ".menu";
+ menuConfigFolder.mkdirs();
+ FileWriter menuFileWriter;
+ boolean failed = false;
+ try{
+
+ menuFileWriter = new FileWriter(menuFilePath);
+ menuFileWriter.write(menuFile);
+ menuFileWriter.close();
+ }
+ catch(Exception ignore)
+ {
+ failed = true;
+ Debug.log("Failed to create menu for gnome.");
+ }
+ if(!failed) UninstallData.getInstance().addFile(menuFilePath);
+
+ }
for (int i = 0; i < shortcuts.size(); i++)
{
data = (ShortcutData) shortcuts.elementAt(i);
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 2007-02-17 13:38:23 UTC (rev 1741)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/util/os/Unix_Shortcut.java 2007-02-17 13:47:35 UTC (rev 1742)
@@ -65,6 +65,7 @@
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
+import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Enumeration;
@@ -109,6 +110,7 @@
/** QM = "\"" : <b>Q</b>uotation<b>M</b>ark */
private final static String QM = "\"";
+ private int ShortcutType;
private static ShellScript rootScript = null;
private static ShellScript uninstallScript = null;
private static ArrayList users = UnixUsers.getUsersWithValidShellsExistingHomesAndDesktops();
@@ -168,7 +170,8 @@
hlp.append("Comment[").append(userLanguage).append("]=" + $Comment + N);
hlp.append("Encoding=" + $Encoding + N);
- hlp.append("TryExec=" + $TryExec + N);
+ // this causes too many problems
+ //hlp.append("TryExec=" + $E_QUOT + $Exec + $E_QUOT + S + $Arguments + N);
hlp.append("Exec=" + $E_QUOT + $Exec + $E_QUOT + S + $Arguments + N);
hlp.append("GenericName=" + $GenericName + N);
@@ -187,6 +190,7 @@
hlp.append("TerminalOptions=" + $Options_For_Terminal + N);
hlp.append("Type=" + $Type + N);
+
hlp.append("URL=" + $URL + N);
hlp.append("X-KDE-SubstituteUID=" + $X_KDE_SubstituteUID + N);
hlp.append("X-KDE-Username=" + $X_KDE_Username + N);
@@ -311,7 +315,7 @@
//
result = getKdeShareApplnkFolder(current_user).toString();
-
+
return result;
}
@@ -325,6 +329,12 @@
*/
private File getKdeShareApplnkFolder(int userType)
{
+ /*
+ //newer XDG system
+ File xdgPath = new File("usr" + File.separator + "share" + File.separator
+ + "applications");
+ if(xdgPath.exists()) return xdgPath;*/
+
File kdeBase = getKdeBase(userType);
File result = new File(kdeBase + File.separator + "share" + File.separator
@@ -421,11 +431,12 @@
boolean rootUser4All = this.getUserType() == Shortcut.ALL_USERS;
boolean create4All = this.getCreateForAll().booleanValue();
-
+
// Create The Desktop Shortcuts
if ("".equals(this.itsGroupName) && (this.getLinkType() == Shortcut.DESKTOP))
{
-
+ //System.out.println("this.itsGroupName: "+this.itsGroupName);
+ //System.out.println("this.getLinkType(): "+this.getLinkType());
target = myHome + FS + "Desktop" + FS + this.itsName
+ DESKTOP_EXT;
this.itsFileName = target;
@@ -546,15 +557,23 @@
// 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
+ // the following is for backwards compatibility to older versions of KDE!
+ // on newer versions of KDE the icons will appear duplicated unless you set
+ // the category=""
+ Object categoryobject = props.getProperty($Categories);
+ if(categoryobject != null && ((String)categoryobject).length()>0)
+ {
+ File kdeHomeShareApplnk = getKdeShareApplnkFolder(this.getUserType());
+ target = kdeHomeShareApplnk.toString() + FS + this.itsGroupName + FS + this.itsName
+ DESKTOP_EXT;
- this.itsFileName = target;
- writeShortCut(target, shortCutDef);
-
- if (rootUser4All)
+ this.itsFileName = target;
+ File kdemenufile = writeShortCut(target, shortCutDef);
+
+ uninstaller.addFile(kdemenufile.toString());
+ }
+
+ if (rootUser4All && create4All)
{
- if (create4All)
{
// write the icon pixmaps into /usr/share/pixmaps
@@ -581,12 +600,52 @@
uninstaller.addFile(writtenFile.toString());
}
- else
- {
- // do nothing
- }
}
+ else // create local XDG shortcuts
+ {
+ //System.out.println("Creating gnome shortcut");
+ String localApps = myHome + "/.local/share/applications/";
+ String localPixmaps = myHome + "/.local/share/pixmaps/";
+ //System.out.println("Creating "+localApps);
+ try
+ {
+ java.io.File f = new java.io.File(localApps);
+ f.mkdirs();
+
+ f = new java.io.File(localPixmaps);
+ f.mkdirs();
+ }
+ catch (Exception ignore)
+ {
+ //System.out.println("Failed creating "+localApps + " or " + localPixmaps);
+ Debug.log("Failed creating "+localApps + " or " + localPixmaps);
+ }
+
+ // write the icon pixmaps into ~/share/pixmaps
+ File theIcon = new File(this.getIconLocation());
+ File commonIcon = new File(localPixmaps + theIcon.getName());
+
+ try
+ {
+ copyTo(theIcon, commonIcon);
+ uninstaller.addFile(commonIcon.toString());
+ }
+ catch (Exception cnc)
+ {
+ Debug.log("Could Not Copy: " + theIcon + " to " + commonIcon + "( "
+ + cnc.getMessage() + " )");
+ }
+
+ // write *.desktop.file into ~/share/applications
+
+ String commonTarget = localApps + this.itsName + DESKTOP_EXT;
+ this.itsFileName = target;
+ File writtenFile = writeShortCut(commonTarget, shortCutDef);
+
+ uninstaller.addFile(writtenFile.toString());
+ }
+
}
}
@@ -767,8 +826,9 @@
*
* @see com.izforge.izpack.util.os.Shortcut#setLinkType(int)
*/
- public void setLinkType(int aType) throws IllegalArgumentException
+ public void setLinkType(int aType) throws IllegalArgumentException, UnsupportedEncodingException
{
+ ShortcutType = aType;
}
/**
@@ -1026,5 +1086,9 @@
{
props.put($TryExec, aTryExec);
}
-
+ public int getLinkType()
+ {
+ return ShortcutType;
+ //return Shortcut.DESKTOP;
+ }
}
More information about the izpack-changes
mailing list