-
-
Save bruienne/74ace1435cd5ce16b384 to your computer and use it in GitHub Desktop.
Update unsigned/Sandbox-unaware PDEs (Print Dialog Extension) to work with Mavericks' heightened Sandboxing requirements.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os | |
import plistlib | |
# Modify basepath to point to another vendors' PDEs as needed. | |
basepath = '/Library/Printers/KONICAMINOLTA' | |
for root, dirs, files in os.walk(basepath): | |
for file in files: | |
if file.endswith('Info.plist'): | |
plist = plistlib.readPlist(os.path.join(root, file)) | |
plist['PMSandboxCompatiblePDEs'] = True | |
print 'Modifying ' + os.path.join(root, file) | |
plistlib.writePlist(plist, os.path.join(root, file)) |
nice!
In Ruby and including OS and directory checks
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
require 'find'
require 'osx/cocoa'
include OSX
MAC_OS_X_MAJOR_VERSION = `/usr/bin/sw_vers -productVersion`.chomp.to_f
KM_PDE_DIR = '/Library/Printers/KONICAMINOLTA'
if MAC_OS_X_MAJOR_VERSION >= 10.9
if File.exists? KM_PDE_DIR
Find.find(KM_PDE_DIR) do |path|
if File.basename(path).eql? "Info.plist"
plist = NSDictionary.dictionaryWithContentsOfFile path
plist["PMSandboxCompatiblePDEs"] = true
plist.writeToFile_atomically(path, true)
end
end
end
else
puts "Nothing to do here..."
end
exit 0
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Modify 'basepath' for your needs.