PATCH: desktop entry spec 0.9.7 Exec key parsing

Bastian, Waldo waldo.bastian at intel.com
Mon Nov 13 20:37:30 EET 2006


>On Fri, 2006-11-03 at 10:53 -0800, Bastian, Waldo wrote:
>> 1) According to the current spec Exec=foobar.sh "%f" and
Exec=foobar.sh
>> %f are both valid and equivalent. Unfortunately gnome adds single
quotes
>> around the filepath when using "%f" effectively making the path
>> unusable. The bright side is that such quotes are useful when doing
>> Exec=/bin/sh "foobar.sh %f". Please advice how we can capture this in
>> the spec.
>
>How about if you have a % code inside quotes, but there are no spaces
>inside the quotes as well, like in:
>
>    Exec=foobar.sh "%f"
>
>then it means the same as if the quotes weren't there:
>
>    Exec=foobar.sh %f
>
>but if you have a %-code inside a quoted area that includes spaces as
>well, like
>
>   /bin/sh -c "foobar.sh %f"
>
>then you have to requote it inside the quotes.
>
>Either that or just don't allow the second case, and say that if a %
>code is inside quotes, it has to be the only thing in that set of
>quotes, and the behavior is exactly the same as if the quotes weren't
>there.

I'm inclined to disallow both cases because both are currently treated
different between Gnome and KDE and without a strong commitment to make
changes to the existing implementations I don't think it makes sense to
specify anything else in the spec.

>Another thing possibly worth mentioning is that
>
>    Exec=foobar.sh --input=%F
>
>is syntactically valid, but doesn't expand to what you probably want.
>(KDE expands it to
>
>    foobar.sh --input=file1 file2 file3
>
>GNOME inserts a word break before file1, which is probably a bug.)

Yes, I don't think it makes sense to use %F or %U other than as a
stand-alone argument.

So please review the attached patch, it makes the following changes:

* Clearify that %U may result in either local paths or file: URLs

* Deprecate %d, %n, %D and %N. They aren't usable on Gnome and you can
do the same with dirname and basename in a script.

* Clearify that %f, %u, %F or %U should only be used once.

* Clearify that these codes should be ignored if there is no file to
open.

* Clearify that %f may be assumed if none is specified.

* Forbid the use of field codes in quoted arguments.

* Clearify that %F and %U should only be used as a stand alone argument.

Cheers,
Waldo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: desktop_entry_exec.patch
Type: application/octet-stream
Size: 3321 bytes
Desc: desktop_entry_exec.patch
Url : http://lists.freedesktop.org/archives/xdg/attachments/20061113/d2a82e76/attachment.obj 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/xdg/attachments/20061113/d2a82e76/attachment.html 


More information about the xdg mailing list