Construct ExecBuilder.
Add literal argument which is not field code.
Add "%c" field code (name of application).
Add "%f" field code.
Add "%F" field code.
Add "%i" field code.
Add "%k" field code (location of desktop file).
Get resulting string that can be set to Exec field of Desktop Entry. The returned string is escaped.
Add "%u" field code.
Add "%U" field code.
1 assert(ExecBuilder("quoted program").icon() 2 .argument("-w").displayName() 3 .argument("$value") 4 .argument("slash\\") 5 .argument("100%") 6 .location("--location=") 7 .urls().url().file("--file=").files().result() == `"quoted program" %i -w %c "\\$value" "slash\\\\" 100%% --location=%k %U %u --file=%f %F`); 8 9 assert(ExecBuilder("program").argument("").url("my url ").result() == `program "" "my url %u"`); 10 11 assertThrown(ExecBuilder("./relative/path"));
Helper struct to build Exec string for desktop file. Note: While Desktop Entry Specification says that field codes must not be inside quoted argument, ExecBuilder does not consider it as error and may create quoted argument if field code is prepended by the string that needs quotation.