Skip to content

Imports binary property lists to XML format #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions Commands/Import Binary Property List.tmCommand
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,32 @@
<string>nop</string>
<key>command</key>
<string>#!/bin/bash
echo '// !!! BINARY PROPERTY LIST WARNING !!!'
echo '//'
echo '// The pretty-printed property list below has been created'
echo '// from a binary version on disk and should not be saved as'
echo '// the ASCII format is a subset of the binary representation!'
echo '//'
"${TM_BUNDLE_SUPPORT}/bin/pretty_plist"
if plist_xml="$(/usr/bin/plutil -convert xml1 -o - -- -)"
then
read -r -d '' warning &lt;&lt;EOF
&lt;!--
!!! BINARY PROPERTY LIST WARNING !!!

This XML property list has been created from a binary
version on disk. If saved, it will overwrite the binary
version with the XML version. This should not normally
cause any problems, except for a larger file size. If the
file needs to be in binary format, convert it to binary
after saving using /usr/bin/plutil
--&gt;
EOF
/usr/bin/perl -pe 's#(&lt;plist version=\x{22}1.0\x{22}&gt;)#'"$warning"'\n$1#' &lt;&lt;&lt; "$plist_xml"

# If conversion to XML failed, fall back to pretty_plist.
else
echo '// !!! BINARY PROPERTY LIST WARNING !!!'
echo '//'
echo '// The pretty-printed property list below has been created'
echo '// from a binary version on disk and should not be saved as'
echo '// the ASCII format is a subset of the binary representation!'
echo '//'
"${TM_BUNDLE_SUPPORT}/bin/pretty_plist"
fi
</string>
<key>contentMatch</key>
<string>\Abplist00</string>
Expand Down