CHM Input: Handle CHM files that dont specify a topics file. Fixes #9253 (Failed to convert .chm file)

This commit is contained in:
Kovid Goyal 2011-03-03 12:39:29 -07:00
parent 5ade2ccc74
commit 448c405ef2

View File

@ -54,8 +54,12 @@ class CHMReader(CHMFile):
self._extracted = False self._extracted = False
# location of '.hhc' file, which is the CHM TOC. # location of '.hhc' file, which is the CHM TOC.
self.root, ext = os.path.splitext(self.topics.lstrip('/')) if self.topics is None:
self.hhc_path = self.root + ".hhc" self.root, ext = os.path.splitext(self.home.lstrip('/'))
self.hhc_path = self.root + ".hhc"
else:
self.root, ext = os.path.splitext(self.topics.lstrip('/'))
self.hhc_path = self.root + ".hhc"
def _parse_toc(self, ul, basedir=os.getcwdu()): def _parse_toc(self, ul, basedir=os.getcwdu()):
toc = TOC(play_order=self._playorder, base_path=basedir, text='') toc = TOC(play_order=self._playorder, base_path=basedir, text='')