no need to delete the contents of the specified directory

This commit is contained in:
Fabian Graßl 2010-11-03 15:05:46 +01:00
parent e3a9863f9f
commit 78b66ad54d

View File

@ -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')), help=_('Template used for the generation of the html contents of the book instead of the default file')),
OptionRecommendation(name='extract_to', 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) zfile.write(output_file, basename(output_file), zipfile.ZIP_DEFLATED)
if opts.extract_to: if opts.extract_to:
if os.path.exists(opts.extract_to): if not os.path.exists(opts.extract_to):
shutil.rmtree(opts.extract_to) os.makedirs(opts.extract_to)
os.makedirs(opts.extract_to)
zfile.extractall(opts.extract_to) zfile.extractall(opts.extract_to)
self.log('Zip file extracted to', opts.extract_to) self.log('Zip file extracted to', opts.extract_to)