desktop entry spec TryExec key
Vincent Untz
vuntz at gnome.org
Sat Mar 24 04:18:21 PDT 2007
Hi,
Le vendredi 23 mars 2007, à 10:31, Brian J. Tarricone a écrit :
> Hi all,
>
> We're revisiting our desktop menu implementation in Xfce, and I'm
> looking at some old hacks I put into the old implementation to sanitise
> the Exec and/or TryExec keys before using them.
>
> Regarding the TryExec key, what can I expect to find there? Are the
> 'field codes' allowed in the Exec key also allowed in TryExec (I would
> think/hope not)? How is quoting handled? Same as Exec?
The spec says:
"File name of a binary on disk used to determine if the program is
actually installed. If not, entry may not show in menus, etc."
So, no field code, no quoting, etc. Only a file name.
> Basically my question is this: can I take the value of TryExec and
> pass it unaltered to something like g_find_program_in_path() and expect
> that to always work? If not, what are the problems with that? The
> desktop entry spec says very little about TryExec.
Hrm, interesting. The spec doesn't say that we should look in PATH, so
this would imply that we expect an absolute path. Sounds broken.
> Also, I'm realising the desktop entry spec is very ambiguous as to how
> to even use TryExec:
>
> "File name of a binary on disk used to determine if the program is
> actually installed. If not, entry may not show in menus, etc."
>
> What does 'used to determine' mean in this context? Was the original
> intention that the TryExec program should actually be *executed* to
> determine if the program is installed (my assumption is no)? Or is
> just verifying that the program exists, is in PATH, is exectuable, etc.
> all that's intended here?
It's not ambiguous to me: it definitely should not be executed. It's
just the verifications you're mentioning (although I'm not sure it's
required to verify the filename is executable).
Would this definition fix all the issues?
"Path to an executable file on disk used to determine if the program is
actually installed. If the path is not an absolute path, the file is
looked up in the $PATH environment variable. If the file is not
not present or if it is not executable, the entry may be ignored (not be
used in menus, for example)."
Vincent
--
Les gens heureux ne sont pas pressés.
More information about the xdg
mailing list