desktopToDarwinBundle: Implement %f and %u Exec field codes

`%f` and `%u` are used to signal the program only accepts a single file
or URI argument. I do not believe there's a way to signal this
information to macOS but it is possible the program really won't work if
multiple files are passed and it's possible the relative position of
`%i`, `%c` or `%k` matters. So we replace `%f` or `%u` with `$1`. That
way we only pass one file in the (possibly significant) position of the
field code.
This commit is contained in:
toonn 2022-03-31 14:04:52 +02:00
parent 196f989ae8
commit f31d945755
No known key found for this signature in database
GPG Key ID: 44FF902A66DF4576

View File

@ -178,7 +178,8 @@ processExecFieldCodes() {
local -r execNoKC="${execNoK/\%c/$(getDesktopParam "${file}" "Name")}"
local -r icon=$(getDesktopParam "${file}" "Icon")
local -r execNoKCI="${execNoKC/\%i/${icon:+--icon }${icon}}"
local -r exec="${execNoKCI// %[fFuU]}"
local -r execNoKCIfu="${execNoKCI/\%[fu]/\$1}"
local -r exec="${execNoKCIfu// %[FU]}"
if [[ "$exec" != "$execRaw" ]]; then
echo 1>&2 "desktopToDarwinBundle: Application bundles do not understand desktop entry field codes. Changed '$execRaw' to '$exec'."
fi