X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=python%2Fbook_base.py;h=1d0d9eca990407f3671a03c54af143515eef295e;hb=b0dce4ca74c6ebf43a3f574ccf281b8bc58a3b75;hp=b73f37336e4f3975dce9ffd7c7a47de6bcd33b8f;hpb=d4a36739fbf2b85e3a6c85fdf76b482b8c07b656;p=lilypond.git diff --git a/python/book_base.py b/python/book_base.py index b73f37336e..1d0d9eca99 100644 --- a/python/book_base.py +++ b/python/book_base.py @@ -14,9 +14,11 @@ error = ly.error # Helper functions ######################################################################## -def find_file (name, include_path, raise_error=True): - for i in include_path: +def find_file (name, include_path, working_dir=None, raise_error=True): + current_path = working_dir or os.getcwd(); + for i in [current_path] + include_path: full = os.path.join (i, name) + full = os.path.normpath (os.path.join (current_path, full)) if os.path.exists (full): return full @@ -149,7 +151,8 @@ class BookOutputFormat: return [] def input_fullname (self, input_filename): - return find_file (input_filename, self.global_options.include_path) + return find_file (input_filename, self.global_options.include_path, + self.global_options.original_dir) def adjust_snippet_command (self, cmd): return cmd @@ -172,7 +175,8 @@ class BookOutputFormat: rep = snippet.get_replacements () if PRINTFILENAME in snippet.option_dict: rep['base'] = basename - rep['filename'] = os.path.basename (snippet.substring ('filename')) + rep['filename'] = os.path.basename (snippet.filename) + rep['ext'] = snippet.ext str = self.output[PRINTFILENAME] % rep return str