r488 - in trunk: . examples/duke3d/scripts scripts
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Fri Feb 15 03:50:34 EST 2008
Author: icculus
Date: 2008-02-15 03:50:33 -0500 (Fri, 15 Feb 2008)
New Revision: 488
Modified:
trunk/docs.txt
trunk/examples/duke3d/scripts/config.lua
trunk/scripts/mojosetup_mainline.lua
Log:
Desktop menu item fixes: format command line string to insert Destination dir,
don't dereference a nil value in revert if fatal() happens before destination
is set.
Modified: trunk/docs.txt
===================================================================
--- trunk/docs.txt 2008-02-14 00:42:30 UTC (rev 487)
+++ trunk/docs.txt 2008-02-15 08:50:33 UTC (rev 488)
@@ -760,7 +760,10 @@
commandline (no default, mustExist, mustBeString, cantBeEmpty)
This is the command line that will be used to launch the application
- when the end user clicks on the desktop menu item.
+ when the end user clicks on the desktop menu item. The string "%0" is
+ replaced with the install destination, so if you need an absolute path
+ to mygame.exe, and the user is installing to /home/user/mygame, you should
+ specify "%0/mygame.exe" to get "/home/user/mygame/mygame.exe".
category (no default, mustExist, mustBeStringOrTableOfStrings)
Modified: trunk/examples/duke3d/scripts/config.lua
===================================================================
--- trunk/examples/duke3d/scripts/config.lua 2008-02-14 00:42:30 UTC (rev 487)
+++ trunk/examples/duke3d/scripts/config.lua 2008-02-15 08:50:33 UTC (rev 488)
@@ -78,7 +78,7 @@
tooltip = "Always bet on Duke!",
builtin_icon = false,
icon = "duke3d.png", -- relative to the dest; you must install it!
- commandline = "/home/icculus/duke3d/duke3d",
+ commandline = "%0/duke3d",
category = "Game",
},
Modified: trunk/scripts/mojosetup_mainline.lua
===================================================================
--- trunk/scripts/mojosetup_mainline.lua 2008-02-14 00:42:30 UTC (rev 487)
+++ trunk/scripts/mojosetup_mainline.lua 2008-02-15 08:50:33 UTC (rev 488)
@@ -1017,12 +1017,15 @@
local function install_freedesktop_menuitem(pkg, idx, item) -- only for Unix.
local icon
+ local dest = MojoSetup.destination
if item.builtin_icon then
icon = item.icon
else
- icon = MojoSetup.destination .. "/" .. item.icon
+ icon = dest .. "/" .. item.icon
end
+ local cmdline = MojoSetup.format(item.commandline, dest)
+
local str = "[Desktop Entry]\n" ..
"Encoding=UTF-8\n" ..
"Value=1.0\n" ..
@@ -1031,7 +1034,7 @@
"GenericName=" .. item.genericname .. "\n" ..
"Comment=" .. item.tooltip .. "\n" ..
"Icon=" .. icon .. "\n" ..
- "Exec=" .. item.commandline .. "\n" ..
+ "Exec=" .. cmdline .. "\n" ..
"Categories=" .. flatten_list(item.category) .. "\n"
if item.mimetype ~= nil then
@@ -1040,16 +1043,16 @@
str = str .. "\n"
- local dest = freedesktop_menuitem_filename(pkg, idx)
+ local fname = freedesktop_menuitem_filename(pkg, idx)
local perms = "0644" -- !!! FIXME
local key = MojoSetup.metadatakey
local desc = MojoSetup.metadatadesc
--MojoSetup.logdebug("Install FreeDesktop file")
- --MojoSetup.logdebug(dest)
+ --MojoSetup.logdebug(fname)
--MojoSetup.logdebug(str)
- install_file_from_string(dest, str, perms, desc, key)
- if not MojoSetup.platform.installdesktopmenuitem(dest) then
+ install_file_from_string(fname, str, perms, desc, key)
+ if not MojoSetup.platform.installdesktopmenuitem(fname) then
MojoSetup.fatal(_("Failed to install desktop menu item"))
end
end
@@ -1101,6 +1104,7 @@
MojoSetup.downloaded = 0
MojoSetup.totaldownload = 0
MojoSetup.install = install
+ MojoSetup.installed_menu_items = false
-- !!! FIXME: try to sanity check everything we can here
-- !!! FIXME: (unsupported URLs, bogus media IDs, etc.)
@@ -1518,7 +1522,10 @@
end
end
- install_desktop_menu_items(install)
+ if install.desktopmenuitems ~= nil then
+ install_desktop_menu_items(install)
+ MojoSetup.installed_menu_items = true
+ end
if install.support_uninstall then
if MojoSetup.info.platform == "windows" then
@@ -1602,6 +1609,7 @@
MojoSetup.downloaddir = nil
MojoSetup.install = nil
MojoSetup.forceoverwrite = nil
+ MojoSetup.installed_menu_items = nil
MojoSetup.stages = nil
MojoSetup.files = nil
MojoSetup.media = nil
@@ -1620,7 +1628,10 @@
MojoSetup.loginfo("Cleaning up half-finished installation...")
-- !!! FIXME: callbacks here.
- uninstall_desktop_menu_items(MojoSetup.install)
+ if MojoSetup.installed_menu_items then
+ uninstall_desktop_menu_items(MojoSetup.install)
+ end
+
delete_files(MojoSetup.downloads)
delete_files(flatten_manifest(MojoSetup.manifest, prepend_dest_dir))
do_rollbacks()
More information about the mojosetup-commits
mailing list