mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
no need to delete the contents of the specified directory
This commit is contained in:
parent
e3a9863f9f
commit
78b66ad54d
@ -39,7 +39,7 @@ class HTMLOutput(OutputFormatPlugin):
|
||||
help=_('Template used for the generation of the html contents of the book instead of the default file')),
|
||||
|
||||
OptionRecommendation(name='extract_to',
|
||||
help=_('Extract the contents of the generated ZIP file to the directory of the generated ZIP file')
|
||||
help=_('Extract the contents of the generated ZIP file to the specified directory')
|
||||
),
|
||||
])
|
||||
|
||||
@ -193,9 +193,8 @@ class HTMLOutput(OutputFormatPlugin):
|
||||
zfile.write(output_file, basename(output_file), zipfile.ZIP_DEFLATED)
|
||||
|
||||
if opts.extract_to:
|
||||
if os.path.exists(opts.extract_to):
|
||||
shutil.rmtree(opts.extract_to)
|
||||
os.makedirs(opts.extract_to)
|
||||
if not os.path.exists(opts.extract_to):
|
||||
os.makedirs(opts.extract_to)
|
||||
zfile.extractall(opts.extract_to)
|
||||
self.log('Zip file extracted to', opts.extract_to)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user