1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-13 09:46:25 +00:00

Fixed tmp directories

This commit is contained in:
Paweł Jastrzębski
2013-08-13 10:48:42 +02:00
parent ff91eb1407
commit 5f8e5e0be9

View File

@@ -598,8 +598,8 @@ def genEpubStruct(path):
def getWorkFolder(afile):
workdir = tempfile.mkdtemp('', 'KCC-TMP-', os.path.join(os.path.splitext(afile)[0], '..'))
if os.path.isdir(afile):
workdir = tempfile.mkdtemp('', 'KCC-TMP-', os.path.join(os.path.splitext(afile)[0], '..'))
try:
os.rmdir(workdir) # needed for copytree() fails if dst already exists
fullPath = os.path.join(workdir, 'OEBPS', 'Images')
@@ -613,10 +613,10 @@ def getWorkFolder(afile):
pdf = pdfjpgextract.PdfJpgExtract(afile)
path, njpg = pdf.extract()
if njpg == 0:
rmtree(workdir)
rmtree(path)
raise UserWarning("Failed to extract images.")
else:
workdir = tempfile.mkdtemp('', 'KCC-TMP-', os.path.splitext(afile)[0])
cbx = cbxarchive.CBxArchive(afile)
if cbx.isCbxFile():
try: