Documentation
¶
Overview ¶
Package desktopentry escapes and reads the string values of a freedesktop Desktop Entry file, writes one from its keys, and rewrites a single key while keeping the rest.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Exec ¶
Exec builds an Exec= value from argv. argv[0] is always double-quoted; any other argument is quoted when it is empty (written `""`) or holds a reserved character: space, tab, CR, LF, `"`, `'`, `\`, `>`, `<`, `~`, `|`, `&`, `;`, `$`, `*`, `?`, `#`, `(`, `)` or "`". Inside quotes `"`, "`", `$` and `\` are backslash-escaped. Every `%` becomes `%%`. Then the whole line gets the string escapes, because the spec undoes those before the Exec quoting: `\` doubled, a tab as `\t`, CR as `\r` and LF as `\n`. Field codes (%u, %f) are appended by the caller after the call.
func SetKey ¶ added in v0.8.0
SetKey rewrites the first key= line in a Desktop Entry file. Every other line stays, in order, including keys Marshal would not write. value is the already-escaped right-hand side (see Value and Exec). A trailing newline on that line is kept if it was there. If the file has no such key, SetKey returns an error.
func SplitExec ¶
SplitExec is Exec's reader, for any program's entry: it undoes the string escapes, then the quoting, then `%%`, and returns the arguments. Every other field code (%u, %f, ...) is left in place for the caller to expand. Because `%%` is undone, an argument written `%%u` and a field code `%u` both read back as `%u`.