Insert macOS file association metadata during bundle process

This commit is contained in:
Julia 2023-01-24 17:01:14 -05:00
parent e8cea130a4
commit 4d73d4b1b9
2 changed files with 70 additions and 1 deletions

View file

@ -0,0 +1,62 @@
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeIconFile</key>
<string>Document</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>LSHandlerRank</key>
<string>Default</string>
<key>LSItemContentTypes</key>
<array>
<string>public.text</string>
<string>public.plain-text</string>
<string>public.utf8-plain-text</string>
</array>
</dict>
<dict>
<key>CFBundleTypeIconFile</key>
<string>Document</string>
<key>CFBundleTypeName</key>
<string>Zed Text Document</string>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleTypeOSTypes</key>
<array>
<string>****</string>
</array>
<key>LSHandlerRank</key>
<string>Default</string>
<key>CFBundleTypeExtensions</key>
<array>
<string>Gemfile</string>
<string>c</string>
<string>c++</string>
<string>cc</string>
<string>cpp</string>
<string>css</string>
<string>erb</string>
<string>ex</string>
<string>exs</string>
<string>go</string>
<string>h</string>
<string>h++</string>
<string>hh</string>
<string>hpp</string>
<string>html</string>
<string>js</string>
<string>json</string>
<string>jsx</string>
<string>md</string>
<string>py</string>
<string>rb</string>
<string>rkt</string>
<string>rs</string>
<string>scm</string>
<string>toml</string>
<string>ts</string>
<string>tsx</string>
<string>txt</string>
</array>
</dict>
</array>

View file

@ -22,7 +22,7 @@ cargo build --release --package cli --target x86_64-apple-darwin
echo "Creating application bundle"
pushd crates/zed
channel=$(cat RELEASE_CHANNEL)
channel=$(<RELEASE_CHANNEL)
cp Cargo.toml Cargo.toml.backup
sed \
-i .backup \
@ -49,6 +49,13 @@ echo "Copying WebRTC.framework into the frameworks folder"
mkdir "${app_path}/Contents/Frameworks"
cp -R target/x86_64-apple-darwin/release/WebRTC.framework "${app_path}/Contents/Frameworks/"
mv "${app_path}/Contents/Info.plist" "${app_path}/Contents/WithoutDocumentTypes.plist"
awk \
"/<\/dict>/{while(getline line<\"./crates/zed/BundleDocumentTypes.plist\"){print line}}1" \
"${app_path}/Contents/WithoutDocumentTypes.plist" \
> "${app_path}/Contents/Info.plist"
rm "${app_path}/Contents/WithoutDocumentTypes.plist"
if [[ -n $MACOS_CERTIFICATE && -n $MACOS_CERTIFICATE_PASSWORD && -n $APPLE_NOTARIZATION_USERNAME && -n $APPLE_NOTARIZATION_PASSWORD ]]; then
echo "Signing bundle with Apple-issued certificate"
security create-keychain -p "$MACOS_CERTIFICATE_PASSWORD" zed.keychain || echo ""