summary refs log tree commit diff
path: root/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
diff options
context:
space:
mode:
authortoonn <toonn@toonn.io>2022-03-11 21:52:28 +0100
committertoonn <toonn@toonn.io>2022-03-30 16:42:13 +0200
commit7ef15c96dc6180295d46efb0a0a4f1dd5b0b687a (patch)
treed5f2fc00d2894fa7bff527a41ede1ebb3e6bb860 /pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
parentb52a9621412ab6b2b12885f3875a7a956d4ab46a (diff)
downloadnixpkgs-7ef15c96dc6180295d46efb0a0a4f1dd5b0b687a.tar
nixpkgs-7ef15c96dc6180295d46efb0a0a4f1dd5b0b687a.tar.gz
nixpkgs-7ef15c96dc6180295d46efb0a0a4f1dd5b0b687a.tar.bz2
nixpkgs-7ef15c96dc6180295d46efb0a0a4f1dd5b0b687a.tar.lz
nixpkgs-7ef15c96dc6180295d46efb0a0a4f1dd5b0b687a.tar.xz
nixpkgs-7ef15c96dc6180295d46efb0a0a4f1dd5b0b687a.tar.zst
nixpkgs-7ef15c96dc6180295d46efb0a0a4f1dd5b0b687a.zip
desktopToDarwinBundle: Add X-macOS-Exec and log editing Exec
Co-authored-by: milahu <milahu@gmail.com>
Diffstat (limited to 'pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh')
-rw-r--r--pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh12
1 files changed, 10 insertions, 2 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 0bc454ecc90..5bd71764c61 100644
--- a/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
+++ b/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh
@@ -176,8 +176,16 @@ convertDesktopFile() {
     local -r file=$1
     local -r sharePath=$(dirname "$(dirname "$file")")
     local -r name=$(getDesktopParam "${file}" "^Name")
-    local -r exec=$(getDesktopParam "${file}" "Exec" \
-      | sed -e 's/ %[fFuUick]//g')
+    local -r macOSExec=$(getDesktopParam "${file}" "X-macOS-Exec")
+    if [[ "$macOSExec" ]]; then
+      local -r exec="$macOSExec"
+    else
+      local -r execRaw=$(getDesktopParam "${file}" "Exec")
+      local -r exec="${execRaw// %[fFuUick]}"
+      if [[ "$exec" != "$execRaw" ]]; then
+        echo "desktopToDarwinBundle: Application bundles do not understand desktop entry field codes. Changed '$execRaw' to '$exec'."
+      fi
+    fi
     local -r iconName=$(getDesktopParam "${file}" "^Icon")
     local -r squircle=$(getDesktopParam "${file}" "X-macOS-SquircleIcon")