davideuler / chm2pdf

Automatically exported from code.google.com/p/chm2pdf
GNU General Public License v2.0
0 stars 0 forks source link

chm2pdf deletes data directories when --extract-only is used #34

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. run chm2pdf --extract-only <filename.chm>
2.
3.

What is the expected output? What do you see instead?
This should produce a data directory containing html files.  Instead, data 
directory is deleted.

What version of the product are you using? On what operating system?
chm2pdf v 0.9.1

Please provide any additional information below.

Program source code (with line numbers): 

1069    CHM2PDF_WORK_DIR = CHM2PDF_TEMP_WORK_DIR + os.sep + basename
1070    CHM2PDF_ORIG_DIR = CHM2PDF_TEMP_ORIG_DIR + os.sep + basename

...

1102     convert_to_pdf(cfile, filename, outputfilename, options)
1103     shutil.rmtree(CHM2PDF_TEMP_WORK_DIR)
1104     shutil.rmtree(CHM2PDF_TEMP_ORIG_DIR)

This shows that WORK_DIR and ORIG_DIR are *below* TEMP_WORK_DIR and 
TEMP_ORIG_DIR, and so are deleted at lines 1103, 1104.

Program needs to test for options['extract-only']=='' before calling 
shutil.rmtree(CHM2PDF_TEMP_WORK_DIR).

Original issue reported on code.google.com by deepth...@gmail.com on 6 Aug 2011 at 11:26