diff options
author | toonn <toonn@toonn.io> | 2022-03-30 20:36:23 +0200 |
---|---|---|
committer | toonn <toonn@toonn.io> | 2022-03-31 12:47:54 +0200 |
commit | 4a749a89c453551e107567cdf5d80165383b537f (patch) | |
tree | 24cf39c8de178048e2c21bd17595c1434e1ba4ac /pkgs/build-support/setup-hooks | |
parent | 30e8e0a9a3b11e06f0aed76e25ae5fdd73f833de (diff) |
desktopToDarwinBundle: Implement %k Exec field code
Diffstat (limited to 'pkgs/build-support/setup-hooks')
-rw-r--r-- | pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh | 17 |
1 files changed, 12 insertions, 5 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 b1364db06107b..7ce6c5c82b73f 100644 --- a/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh +++ b/pkgs/build-support/setup-hooks/desktop-to-darwin-bundle.sh @@ -171,6 +171,17 @@ convertIconTheme() { fi } +processExecFieldCodes() { + local -r file=$1 + local -r execRaw=$(getDesktopParam "${file}" "Exec") + local -r execNoK="${execRaw/\%k/${file}}" + local -r exec="${execNoK// %[fFuUic]}" + if [[ "$exec" != "$execRaw" ]]; then + echo 1>&2 "desktopToDarwinBundle: Application bundles do not understand desktop entry field codes. Changed '$execRaw' to '$exec'." + fi + echo "$exec" +} + # For a given .desktop file, generate a darwin '.app' bundle for it. convertDesktopFile() { local -r file=$1 @@ -180,11 +191,7 @@ convertDesktopFile() { 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 + local -r exec=$(processExecFieldCodes "${file}") fi local -r iconName=$(getDesktopParam "${file}" "^Icon") local -r squircle=$(getDesktopParam "${file}" "X-macOS-SquircleIcon") |