Question on desktop file exec lines

David Faure faure at kde.org
Tue Dec 31 02:23:36 PST 2013


On Monday 23 December 2013 09:38:02 Jerome Leclanche wrote:
> See: http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html
> 
> I think I already know the answer to both but I'd like to double-check.
> 
> 1) When dealing with desktop files that have %u or %U in the name, if
> the argument is a relative file path, the file path should be made
> absolute with getcwd(), correct?

Yes, this is the best approach, since the app might start in a different 
working directory and therefore not find the file.

Note that the working directory can be specified in the .desktop file, or can 
be up to the application's startup code - or the way it's started
(cf. kdeinit and other fork-and-exec launchers).

> 2) When dealing with %f or %F, the file path should *not* be expanded,
> correct?

You mean in case it's relative? The same reasoning applies IMHO.

My code (i.e. KDE) never sends relative paths to the program started via a 
desktop file.

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5



More information about the xdg mailing list