>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
desktop_entry_exec.patch
Description: desktop_entry_exec.patch
The Arguments may be quoted in whole. If an argument contains a reserved character the argument must be quoted. The rules for quoting of arguments is also applicable to the executable name or path of the executable program as provided. Quoting must be done by enclosing the argument between double quotes and escaping the double quote character, backtick character ("`"), dollar sign ("$") and backslash character ("\") by preceding it with an additional backslash character. Implementations must undo quoting before expanding field codes and before passing the argument to the executable program. Reserved characters are space (" "), tab, newline, double quote, single quote ("'"), backslash character ("\"), greater-than sign (">"), less-than sign ("<"), tilde ("~"), vertical bar ("|"), ampersand ("&"), semicolon (";"), dollar sign ("$"), asterisk ("*"), question mark ("?"), hash mark ("#"), parenthesis ("(") and (")") and backtick character ("`"). Note that the general escape rule for values of type string states that the backslash character can be escaped as ("\\") as well and that this escape rule is applied before the quoting rule. As such, to unambiguously represent a literal backslash character in a quoted argument in a desktop entry file requires the use of four successive backslash characters ("\\\\"). Likewise, a literal dollar sign in a quoted argument in a desktop entry file is unambiguously represented with ("\\$").
A number of special field codes have been defined which will be
expanded by the file manager or program launcher when encountered
in the command line.
Field codes consist of the percentage character ("%") followed by
an alpha character. Literal percentage characters must be escaped
as Command lines that contain a field code that is not listed in this specification are invalid and must not be processed, in particular implementations may not introduce support for field codes not listed in this specification. Extensions, if any, should be introduced by means of a new key. Implementations must take care not to expand field codes into multiple arguments unless explicitly instructed by this specification. This means that name fields, filenames and other replacements that can contain spaces must be passed as a single argument to the executable program after expansion.
Although the Recognized field codes are as follows:
A command line may contain at most one %f, %u, %F or %U field code. Implementations may assume the presence of a %f field code if none of these field codes is included. If the application should not open any file the %f, %u, %F and %U field codes must be removed from the command line and ignored. Field codes must not be used inside a quoted argument, the result of field code expansion inside a quoted argument is undefined. The %F and %U field codes may only be used as an argument on their own. |
_______________________________________________ xdg mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/xdg
