Relative paths in .desktop files

PCMan pcman.tw at gmail.com
Mon Apr 11 07:08:49 PDT 2011


My fault!
Field code %k is the file path of the desktop entry file, not it's
parent directory.
So if you named the shell script after the desktop file, like
"installer.desktop.sh", I think an Exec key like this should work.
Exec=%k.sh
This is a little bit tricky, but I think it can solve your problem.

On Mon, Apr 11, 2011 at 9:08 PM, Michael Thayer
<michael.thayer at oracle.com> wrote:
> On Sat, 2011-04-09 at 15:34 +0800, PCMan wrote:
>> An easy workaround might be like this:
> [...]
>> Exec=%k/installer.sh
>>
>> The field code %k will be expanded to the location of desktop entry file.
>> This can solve your problem, in a more or less dirty way.
> I tried this out (Nautilus 2.32.0 in Ubuntu 10.10) and unless I did
> something wrong it failed to work.  Among the past threads I found
> discussing this, this posting by Waldo Bastian in 2006 -
> http://lists.freedesktop.org/archives/xdg/2006-August/006885.html -
> sounds like he was happy with the idea of relative paths for icons:
> [quote]
>> Prefix with ./ sounds good:
>>
>> * If it starts with "/" it's an absolute path
>> * If it starts with "./" is's a relative path
>> * Everything else is a themed icon name
> [end quote]
> How would other (particularly GNOME) people today see this (for
> executables too), and if favourably, where should I look for the code
> which Nautilus uses to process desktop files?  I realise of course that
> what I have in mind isn't quite the way .desktop files are used, but it
> is sufficiently close that it seems to me silly to do something
> separate.
>
> Regards,
>
> Michael
>
> P.S. PCMan, I hope that you don't mind my CC-ing this back to the list.
>
>> On Fri, Apr 8, 2011 at 6:28 PM, Michael Thayer
>> <michael.thayer at oracle.com> wrote:
> [...]
>>  I immediately ran up against the
>> > problem that all paths in .desktop files have to be absolute, which
>> > obviously isn't an option here.
>> >
>> > So of course, the question is what the prospects are of getting this
>> > changed (I'm also open to suggestions about better ways).  And since we
>> > are drifting towards the old AppFolder thing here anyway (which I know
>> > has been raised every so often here in the past, but never seems to have
>> > gone anywhere), what about some convention which would let one put
>> > a .desktop file in a directory and have it be a "default" executable for
>> > that directory?
>> >
>> > Just to be clear, since this is not the most important problem we have
>> > to solve I won't be able to spend a lot of time on it, but if someone
>> > can give me good enough pointers I might find a bit of time to write a
>> > couple of patches on my own time out of personal interest.
> --
> ORACLE Deutschland B.V. & Co. KG   Michael Thayer
> Werkstrasse 24                     VirtualBox engineering
> 71384 Weinstadt, Germany           mailto:michael.thayer at oracle.com
>
> Hauptverwaltung: Riesstr. 25, D-80992 München
> Registergericht: Amtsgericht München, HRA 95603
>
> Komplementärin: ORACLE Deutschland Verwaltung B.V.
> Rijnzathe 6, 3454PV De Meern, Niederlande
> Handelsregister der Handelskammer Midden-Niederlande, Nr. 30143697
> Geschäftsführer: Jürgen Kunz, Marcel van de Molen, Alexander van der Ven
>
>


More information about the xdg mailing list