Fix regression in epub2lrf

This commit is contained in:
Kovid Goyal 2008-08-06 15:33:41 -07:00
parent fcdc318a69
commit aa9f6fab79
2 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ from calibre.ebooks import ConversionError
from calibre.ebooks.lrf.html.convert_from import process_file as html_process_file from calibre.ebooks.lrf.html.convert_from import process_file as html_process_file
from calibre.ebooks.metadata.opf import OPF from calibre.ebooks.metadata.opf import OPF
from calibre.ebooks.metadata.epub import OCFDirReader from calibre.ebooks.metadata.epub import OCFDirReader
from calibre.libunzip import extract as zip_extract from calibre.utils.zipfile import ZipFile
from calibre import __appname__, setup_cli_handlers from calibre import __appname__, setup_cli_handlers
@ -26,7 +26,7 @@ def generate_html(pathtoepub, logger):
tdir = mkdtemp(prefix=__appname__+'_') tdir = mkdtemp(prefix=__appname__+'_')
os.rmdir(tdir) os.rmdir(tdir)
try: try:
zip_extract(pathtoepub, tdir) ZipFile(pathtoepub).extractall(tdir)
except: except:
if os.path.exists(tdir) and os.path.isdir(tdir): if os.path.exists(tdir) and os.path.isdir(tdir):
shutil.rmtree(tdir) shutil.rmtree(tdir)

View File

@ -1028,7 +1028,7 @@ class ZipFile:
# Create all upper directories if necessary. # Create all upper directories if necessary.
upperdirs = os.path.dirname(targetpath) upperdirs = os.path.dirname(targetpath)
if upperdirs and not os.path.isdir(upperdirs): if upperdirs and os.path.exists(upperdirs) and not os.path.isdir(upperdirs):
os.unlink(upperdirs) os.unlink(upperdirs)
if upperdirs and not os.path.exists(upperdirs): if upperdirs and not os.path.exists(upperdirs):
os.makedirs(upperdirs) os.makedirs(upperdirs)