mirror of
https://github.com/ciromattia/kcc
synced 2026-09-24 19:57:07 +00:00
Fixed tmp directories
This commit is contained in:
+2
-2
@@ -598,8 +598,8 @@ def genEpubStruct(path):
|
|||||||
|
|
||||||
|
|
||||||
def getWorkFolder(afile):
|
def getWorkFolder(afile):
|
||||||
workdir = tempfile.mkdtemp('', 'KCC-TMP-', os.path.join(os.path.splitext(afile)[0], '..'))
|
|
||||||
if os.path.isdir(afile):
|
if os.path.isdir(afile):
|
||||||
|
workdir = tempfile.mkdtemp('', 'KCC-TMP-', os.path.join(os.path.splitext(afile)[0], '..'))
|
||||||
try:
|
try:
|
||||||
os.rmdir(workdir) # needed for copytree() fails if dst already exists
|
os.rmdir(workdir) # needed for copytree() fails if dst already exists
|
||||||
fullPath = os.path.join(workdir, 'OEBPS', 'Images')
|
fullPath = os.path.join(workdir, 'OEBPS', 'Images')
|
||||||
@@ -613,10 +613,10 @@ def getWorkFolder(afile):
|
|||||||
pdf = pdfjpgextract.PdfJpgExtract(afile)
|
pdf = pdfjpgextract.PdfJpgExtract(afile)
|
||||||
path, njpg = pdf.extract()
|
path, njpg = pdf.extract()
|
||||||
if njpg == 0:
|
if njpg == 0:
|
||||||
rmtree(workdir)
|
|
||||||
rmtree(path)
|
rmtree(path)
|
||||||
raise UserWarning("Failed to extract images.")
|
raise UserWarning("Failed to extract images.")
|
||||||
else:
|
else:
|
||||||
|
workdir = tempfile.mkdtemp('', 'KCC-TMP-', os.path.splitext(afile)[0])
|
||||||
cbx = cbxarchive.CBxArchive(afile)
|
cbx = cbxarchive.CBxArchive(afile)
|
||||||
if cbx.isCbxFile():
|
if cbx.isCbxFile():
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user