This commit is contained in:
relikd
2012-08-01 23:54:14 +02:00
commit 3c28af30c3
6 changed files with 114 additions and 0 deletions

6
Default.sublime-commands Normal file
View File

@@ -0,0 +1,6 @@
[
{
"caption": "Plist Binary: Toggle XML & Binary",
"command": "toggle_binary"
}
]

6
Default.sublime-keymap Normal file
View File

@@ -0,0 +1,6 @@
[
{
"keys": ["super+alt+ctrl+p"],
"command": "toggle_binary"
}
]

32
Main.sublime-menu Normal file
View File

@@ -0,0 +1,32 @@
[
{
"caption": "Preferences",
"mnemonic": "n",
"id": "preferences",
"children":
[
{
"caption": "Package Settings",
"mnemonic": "P",
"id": "package-settings",
"children":
[
{
"caption": "Plist Binary",
"children":
[
{
"caption": "Key Bindings Default",
"command": "open_file",
"args": {
"file": "${packages}/Plist Binary/Default.sublime-keymap",
}
},
{ "caption": "-" }
]
}
]
}
]
}
]

23
Plist Binary.py Normal file
View File

@@ -0,0 +1,23 @@
import sublime, sublime_plugin
import os
class ToggleBinaryCommand(sublime_plugin.TextCommand):
def run_(self, args):
fname = self.view.file_name()
if os.path.splitext(fname)[1].lower() != ".plist":
sublime.error_message("%s: Not a *.plist file!" % PACKAGE_NAME)
return
if self.view.is_dirty():
sublime.error_message("%s: Can't encode an unsaved file!" % PACKAGE_NAME)
return
if self.view.substr(sublime.Region(0, 5)) == "<?xml":
os.system("plutil -convert binary1 " + fname)
self.view.set_syntax_file("Packages/Text/Plain text.tmLanguage")
else:
os.system("plutil -convert xml1 " + fname)
self.view.set_syntax_file("Packages/XML/XML.tmLanguage")
self.view.run_command('revert');

27
README.md Normal file
View File

@@ -0,0 +1,27 @@
A [Sublime Text 2][1] plugin for working with binary plist files. Adds an item to the Command Palette which toggles the format between XML and binary.
Inspired by [John Muchow's blog post][2], licensed under MIT
Copyright (c) 2012 Oleg Geier
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
[1]: http://www.sublimetext.com/
[2]: http://MobileDeveloperTips.com/data-file-management/convert-property-list-plist-between-binary-and-xml-format.html

20
packages.json Normal file
View File

@@ -0,0 +1,20 @@
{
"schema_version": "1.2",
"packages": [
{
"name": "Plist Binary",
"description": "De/Encode .plist files between XML and binary format",
"author": "relikd",
"homepage": "https://github.com/relikd/plist-binary_sublime",
"last_modified": "2012-07-26 17:23:42",
"platforms": {
"osx": [
{
"version": "1.0.0",
"url": "https://nodeload.github.com/relikd/plist-binary_sublime/zipball/master"
}
]
}
}
]
}