Skip to content

Commit

Permalink
Allow desktop menu items to specify the working dir for launched appl…
Browse files Browse the repository at this point in the history
…ications.
  • Loading branch information
icculus committed Nov 11, 2010
1 parent 55ed6f6 commit e58161e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs.txt
Expand Up @@ -935,6 +935,17 @@ Here are the elements, and the attributes they can possess.
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".

workingdir (no default, mustBeString, cantBeEmpty)

This is the path that should be set to the current working directory when
launching the installed application. The string "%0" is replaced with the
install destination, so if you need an absolute path to somedir, and the
user is installing to /home/user/mygame, you should specify "%0/somedir"
to get "/home/user/mygame/somedir". If not specified, the system will
choose a directory for you, which is not what you want if you need a
specific path. Non-absolute paths are not recommended unless you know what
you're doing.

category (no default, mustExist, mustBeStringOrTableOfStrings)

This is a category (or array of categories) that the menu item applies
Expand Down
1 change: 1 addition & 0 deletions scripts/mojosetup_init.lua
Expand Up @@ -455,6 +455,7 @@ function Setup.DesktopMenuItem(tab)
{ "builtin_icon", nil, mustBeBool },
{ "icon", nil, mustExist, mustBeString, cantBeEmpty },
{ "commandline", nil, mustExist, mustBeString, cantBeEmpty },
{ "workingdir", nil, mustBeString, cantBeEmpty },
{ "category", nil, mustExist, mustBeStringOrTableOfStrings },
{ "mimetype", nil, mustBeStringOrTableOfStrings },
})
Expand Down
4 changes: 4 additions & 0 deletions scripts/mojosetup_mainline.lua
Expand Up @@ -1146,6 +1146,10 @@ local function install_freedesktop_menuitem(pkg, idx, item) -- only for Unix.
addpair("MimeType", flatten_list(item.mimetype))
end

if item.workingdir ~= nil then
addpair("Path", MojoSetup.format(item.workingdir, dest))
end

t[#t+1] = '\n'

local fname = freedesktop_menuitem_filename(pkg, idx)
Expand Down

0 comments on commit e58161e

Please sign in to comment.