1
0
mirror of https://github.com/ciromattia/kcc synced 2026-02-19 02:29:04 +00:00

don't overwrite mobi output with same name (#1246)

This commit is contained in:
Alex Xu
2026-02-09 11:30:59 -08:00
committed by GitHub
parent 1dce4f8d2c
commit d189f9909d

View File

@@ -963,6 +963,13 @@ def getOutputFilename(srcpath, wantedname, ext, tomenumber):
while os.path.isfile(basename + '_kcc' + str(counter) + ext):
counter += 1
filename = basename + '_kcc' + str(counter) + ext
elif options.format == 'MOBI' and ext == '.epub':
counter = 0
basename = os.path.splitext(filename)[0]
if os.path.isfile(basename + '.mobi'):
while os.path.isfile(basename + '_kcc' + str(counter) + '.mobi'):
counter += 1
filename = basename + '_kcc' + str(counter) + ext
return filename