This commit is contained in:
Kovid Goyal 2014-01-28 13:38:35 +05:30
parent 26ad1042a0
commit 6c04e010a5

View File

@ -40,6 +40,7 @@ class CHMError(Exception):
pass
class CHMReader(CHMFile):
def __init__(self, input, log, input_encoding=None):
CHMFile.__init__(self)
if isinstance(input, unicode):
@ -83,7 +84,6 @@ class CHMReader(CHMFile):
# print toc
return toc
def GetFile(self, path):
# have to have abs paths for ResolveObject, but Contents() deliberately
# makes them relative. So we don't have to worry, re-add the leading /.
@ -226,7 +226,8 @@ class CHMReader(CHMFile):
if os.path.exists(ipath):
continue
src = src.split(';')[0]
if not src: continue
if not src:
continue
ipath = os.path.join(base, *src.split('/'))
if not os.path.exists(ipath):
while src.startswith('../'):
@ -277,6 +278,3 @@ class CHMReader(CHMFile):
def extract_content(self, output_dir=os.getcwdu(), debug_dump=False):
self.ExtractFiles(output_dir=output_dir, debug_dump=debug_dump)