From 78b66ad54d67f448b59e09628ffb3226de80543a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gra=C3=9Fl?= Date: Wed, 3 Nov 2010 15:05:46 +0100 Subject: [PATCH] no need to delete the contents of the specified directory --- src/calibre/ebooks/html/output.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/calibre/ebooks/html/output.py b/src/calibre/ebooks/html/output.py index 6c81ea8ef5..3acb316c3f 100644 --- a/src/calibre/ebooks/html/output.py +++ b/src/calibre/ebooks/html/output.py @@ -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)