mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
macOS: Fix selecting applications that use binary plist files such as Kindle.app with Open With not working. Fixes #1873972 [Callibre not letting me open mobi file in Kindle](https://bugs.launchpad.net/calibre/+bug/1873972)
This commit is contained in:
parent
0c226161f2
commit
b9082d95dc
1078
src/backports/biplist.py
Normal file
1078
src/backports/biplist.py
Normal file
File diff suppressed because it is too large
Load Diff
@ -11,7 +11,7 @@ from collections import defaultdict
|
|||||||
from calibre.ptempfile import TemporaryDirectory
|
from calibre.ptempfile import TemporaryDirectory
|
||||||
from calibre.utils.icu import numeric_sort_key
|
from calibre.utils.icu import numeric_sort_key
|
||||||
from polyglot.builtins import iteritems, string_or_bytes
|
from polyglot.builtins import iteritems, string_or_bytes
|
||||||
from polyglot.plistlib import loads
|
from polyglot.plistlib import loads_binary_or_xml as loads
|
||||||
|
|
||||||
application_locations = ('/Applications', '~/Applications', '~/Desktop')
|
application_locations = ('/Applications', '~/Applications', '~/Desktop')
|
||||||
|
|
||||||
@ -269,6 +269,8 @@ def get_bundle_data(path):
|
|||||||
with open(info, 'rb') as f:
|
with open(info, 'rb') as f:
|
||||||
plist = loads(f.read())
|
plist = loads(f.read())
|
||||||
except Exception:
|
except Exception:
|
||||||
|
import traceback
|
||||||
|
traceback.print_exc()
|
||||||
return None
|
return None
|
||||||
ans['name'] = plist.get('CFBundleDisplayName') or plist.get('CFBundleName') or ans['name']
|
ans['name'] = plist.get('CFBundleDisplayName') or plist.get('CFBundleName') or ans['name']
|
||||||
icfile = plist.get('CFBundleIconFile')
|
icfile = plist.get('CFBundleIconFile')
|
||||||
|
@ -8,5 +8,7 @@ from polyglot.builtins import is_py3
|
|||||||
|
|
||||||
if is_py3:
|
if is_py3:
|
||||||
from plistlib import loads, dumps, Data # noqa
|
from plistlib import loads, dumps, Data # noqa
|
||||||
|
loads_binary_or_xml = loads
|
||||||
else:
|
else:
|
||||||
from plistlib import readPlistFromString as loads, writePlistToString as dumps, Data # noqa
|
from plistlib import readPlistFromString as loads, writePlistToString as dumps, Data # noqa
|
||||||
|
from backports.biplist import readPlistFromString as loads_binary_or_xml # noqa
|
||||||
|
Loading…
x
Reference in New Issue
Block a user