-
Notifications
You must be signed in to change notification settings - Fork 56
/
document_types.bash
22 lines (20 loc) · 938 Bytes
/
document_types.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
set -o errexit
set -x
if [ -z "$BUILT_PRODUCTS_DIR" ] ; then
BUILT_PRODUCTS_DIR=build/Debug/
fi
if [ -z "$PROJECT_NAME" ] ; then
PROJECT_NAME=MetaZ
fi
cd "$BUILT_PRODUCTS_DIR"
OUTPUT="$PROJECT_NAME.app/Contents/Info.plist"
for k in "$PROJECT_NAME.app/Contents/PlugIns"/*.mzdataprovider ; do
if [ -n "$(/usr/libexec/PlistBuddy -c "print :CFBundleDocumentTypes" "$k/Contents/Info.plist")" ] ; then
/usr/libexec/PlistBuddy -c "Add :PluginCFBundleDocumentTypes dict" "$OUTPUT"
/usr/libexec/PlistBuddy -c "Merge $k/Contents/Info.plist :PluginCFBundleDocumentTypes" "$OUTPUT"
while /usr/libexec/PlistBuddy -c "Copy :PluginCFBundleDocumentTypes:CFBundleDocumentTypes:0 CFBundleDocumentTypes:0" "$OUTPUT" 2> /dev/null ; do
/usr/libexec/PlistBuddy -c "Delete :PluginCFBundleDocumentTypes:CFBundleDocumentTypes:0" "$OUTPUT"
done
/usr/libexec/PlistBuddy -c "Delete :PluginCFBundleDocumentTypes" "$OUTPUT"
fi
done