mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-10 16:45:51 +03:00
write-darwin-bundle: Invert squircle logic
Older macOS cannot interpret the `CFBundleIconFiles` key so we cannot rewrite the `CFBundleIconFile` entry without special consideration. I opted to fix this by inverting the squircle logic. We always add both the `CFBundleIconFile` and `CFBundleIconFiles` keys. The former is necessary for at least macOS 10.13 and probably 10.12. The latter seems to be ignored on those versions and overrides the former on newer versions of macOS. Inverting the logic also allows us to rely on the `toPlist` generator to generate the XML syntax, which is a nice bonus.
This commit is contained in:
parent
e5e8e1d926
commit
7a40437bdd
@ -5,6 +5,7 @@ let
|
||||
CFBundleDevelopmentRegion = "English";
|
||||
CFBundleExecutable = "$name";
|
||||
CFBundleIconFile = "$icon";
|
||||
CFBundleIconFiles = [ "$icon" ];
|
||||
CFBundleIdentifier = "org.nixos.$name";
|
||||
CFBundleInfoDictionaryVersion = "6.0";
|
||||
CFBundleName = "$name";
|
||||
@ -25,11 +26,8 @@ in writeScriptBin "write-darwin-bundle" ''
|
||||
${pListText}
|
||||
EOF
|
||||
|
||||
if [[ $squircle != 0 && $squircle != "false" ]]; then
|
||||
sed "
|
||||
s|CFBundleIconFile|CFBundleIconFiles|;
|
||||
s|<string>$icon</string>|<array><string>$icon</string></array>|
|
||||
" -i "$plist"
|
||||
if [[ $squircle == 0 || $squircle == "false" ]]; then
|
||||
sed '/CFBundleIconFiles/,\|</array>|d' -i "$plist"
|
||||
fi
|
||||
|
||||
cat > "$prefix/Applications/$name.app/Contents/MacOS/$name" <<EOF
|
||||
|
Loading…
Reference in New Issue
Block a user