mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix polishing of AZW3 files not working on OS X. Fixes #1168789 (Polish does not work on Mac with azw3)
This commit is contained in:
parent
02a5c164f2
commit
5f3f5d1e9b
@ -77,7 +77,7 @@ class Container(object):
|
|||||||
|
|
||||||
# Map of relative paths with '/' separators from root of unzipped ePub
|
# Map of relative paths with '/' separators from root of unzipped ePub
|
||||||
# to absolute paths on filesystem with os-specific separators
|
# to absolute paths on filesystem with os-specific separators
|
||||||
opfpath = os.path.abspath(opfpath)
|
opfpath = os.path.abspath(os.path.realpath(opfpath))
|
||||||
for dirpath, _dirnames, filenames in os.walk(self.root):
|
for dirpath, _dirnames, filenames in os.walk(self.root):
|
||||||
for f in filenames:
|
for f in filenames:
|
||||||
path = join(dirpath, f)
|
path = join(dirpath, f)
|
||||||
@ -483,7 +483,7 @@ class EpubContainer(Container):
|
|||||||
|
|
||||||
def __init__(self, pathtoepub, log):
|
def __init__(self, pathtoepub, log):
|
||||||
self.pathtoepub = pathtoepub
|
self.pathtoepub = pathtoepub
|
||||||
tdir = self.root = PersistentTemporaryDirectory('_epub_container')
|
tdir = self.root = os.path.abspath(os.path.realpath(PersistentTemporaryDirectory('_epub_container')))
|
||||||
with open(self.pathtoepub, 'rb') as stream:
|
with open(self.pathtoepub, 'rb') as stream:
|
||||||
try:
|
try:
|
||||||
zf = ZipFile(stream)
|
zf = ZipFile(stream)
|
||||||
@ -616,7 +616,7 @@ class AZW3Container(Container):
|
|||||||
|
|
||||||
def __init__(self, pathtoazw3, log):
|
def __init__(self, pathtoazw3, log):
|
||||||
self.pathtoazw3 = pathtoazw3
|
self.pathtoazw3 = pathtoazw3
|
||||||
tdir = self.root = PersistentTemporaryDirectory('_azw3_container')
|
tdir = self.root = os.path.abspath(os.path.realpath(PersistentTemporaryDirectory('_azw3_container')))
|
||||||
with open(pathtoazw3, 'rb') as stream:
|
with open(pathtoazw3, 'rb') as stream:
|
||||||
raw = stream.read(3)
|
raw = stream.read(3)
|
||||||
if raw == b'TPZ':
|
if raw == b'TPZ':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user