summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2022-03-31 15:27:39 +0200
committertoonn <toonn@toonn.io>2022-03-31 15:27:39 +0200
commit261b73652131421cd562873191060b02b56db1fe (patch)
tree0ffea3db762888c3c59de0282d538ebb6fbb1699 /pkgs/build-support/setup-hooks
parentf31d9457551315abad6174c08646e39e09f8db70 (diff)
downloadnixpkgs-261b73652131421cd562873191060b02b56db1fe.tar
nixpkgs-261b73652131421cd562873191060b02b56db1fe.tar.gz
nixpkgs-261b73652131421cd562873191060b02b56db1fe.tar.bz2
nixpkgs-261b73652131421cd562873191060b02b56db1fe.tar.lz
nixpkgs-261b73652131421cd562873191060b02b56db1fe.tar.xz
nixpkgs-261b73652131421cd562873191060b02b56db1fe.tar.zst
nixpkgs-261b73652131421cd562873191060b02b56db1fe.zip
desktopToDarwinBundle: Implement %F and %U Exec field codes
Similar to the implementation of the `%f` and `%u` field codes. In this
case the amount of arguments passed poses no problem but the position
could, at least in theory.

This finishes the implementation of all the non-deprecated field codes.
As a part of that, repetitions of field codes are left alone. Originally
all field codes were removed. Now we replace only the first occurence.
This is correct for at least `%f`, `%u`, `%F` and `%U` because at most
one of them is permitted.

Shortcomings:

  1. We replace `%[cfFikuU]` patterns one at a time. This means if the
     right field code appears as part of the rest of the `Exec` field or
     in a field code that was substituted earlier.

  2. If any field code is repeated, only the first occurence is
     substituted.
Diffstat (limited to 'pkgs/build-support/setup-hooks')
-rw-r--r--pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh b/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
index b181ec1dc63..72c1b973666 100644
--- a/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
+++ b/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
@@ -179,7 +179,7 @@ processExecFieldCodes() {
   local -r icon=$(getDesktopParam "${file}" "Icon")
   local -r execNoKCI="${execNoKC/\%i/${icon:+--icon }${icon}}"
   local -r execNoKCIfu="${execNoKCI/\%[fu]/\$1}"
-  local -r exec="${execNoKCIfu// %[FU]}"
+  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