+def adjust_include_path (path, outpath):
+ """Rewrite an include path relative to the dir where lilypond is launched.
+ Always use forward slashes since this is what lilypond expects."""
+ path = os.path.expanduser (path)
+ path = os.path.expandvars (path)
+ path = os.path.normpath (path)
+ if os.path.isabs (outpath):
+ return os.path.abspath (path).replace (os.path.sep, '/')
+ if os.path.isabs (path):
+ return path.replace (os.path.sep, '/')
+ return os.path.join (inverse_relpath (original_dir, outpath), path).replace (os.path.sep, '/')
+