diff --git a/src/calibre/ebooks/conversion/plugins/chm_input.py b/src/calibre/ebooks/conversion/plugins/chm_input.py index 8a7d8da83c..fbdfb48a52 100644 --- a/src/calibre/ebooks/conversion/plugins/chm_input.py +++ b/src/calibre/ebooks/conversion/plugins/chm_input.py @@ -103,6 +103,7 @@ class CHMInput(InputFormatPlugin): from calibre.customize.builtins import HTMLInput opts.breadth_first = True htmlinput = HTMLInput(None) + htmlinput.set_root_dir_of_input(basedir) oeb = htmlinput.create_oebbook(htmlpath, basedir, opts, log, mi) return oeb diff --git a/src/calibre/ebooks/conversion/plugins/html_input.py b/src/calibre/ebooks/conversion/plugins/html_input.py index 9119698b61..b86348ce4e 100644 --- a/src/calibre/ebooks/conversion/plugins/html_input.py +++ b/src/calibre/ebooks/conversion/plugins/html_input.py @@ -76,6 +76,9 @@ class HTMLInput(InputFormatPlugin): } + def set_root_dir_of_input(self, basedir): + self.root_dir_of_input = os.path.normcase(get_long_path_name(os.path.abspath(basedir)) + os.sep) + def convert(self, stream, opts, file_ext, log, accelerators): self._is_case_sensitive = None @@ -86,7 +89,7 @@ class HTMLInput(InputFormatPlugin): if hasattr(stream, 'name'): basedir = os.path.dirname(stream.name) fname = os.path.basename(stream.name) - self.root_dir_of_input = os.path.normcase(get_long_path_name(os.path.abspath(basedir)) + os.sep) + self.set_root_dir_of_input(basedir) if file_ext != 'opf': if opts.dont_package: