+ Buffer const * m_buffer = buffer.getMasterBuffer();
+ string const parentpath = external_in_tmpdir ?
+ m_buffer->temppath() :
+ buffer.filePath();
+ string const filename = external_in_tmpdir ?
+ params.filename.mangledFilename() :
+ params.filename.outputFilename(parentpath);
+ string const basename = support::changeExtension(
+ support::onlyFilename(filename), string());
+ string const absname = support::makeAbsPath(filename, parentpath).absFilename();
+
+ string result = s;
+ if (what != ALL_BUT_PATHS) {
+ string const filepath = support::onlyPath(filename);
+ string const abspath = support::onlyPath(absname);
+ string const masterpath = external_in_tmpdir ?
+ m_buffer->temppath() :
+ m_buffer->filePath();
+ string relToMasterPath = support::onlyPath(
+ support::makeRelPath(absname, masterpath));
+ if (relToMasterPath == "./")
+ relToMasterPath.clear();
+ string relToParentPath = support::onlyPath(
+ support::makeRelPath(absname, parentpath));
+ if (relToParentPath == "./")
+ relToParentPath.clear();
+
+ result = subst_path(result, "$$FPath", filepath,
+ use_latex_path,
+ support::PROTECT_EXTENSION,
+ support::ESCAPE_DOTS);
+ result = subst_path(result, "$$AbsPath", abspath,
+ use_latex_path,
+ support::PROTECT_EXTENSION,
+ support::ESCAPE_DOTS);
+ result = subst_path(result, "$$RelPathMaster",
+ relToMasterPath, use_latex_path,
+ support::PROTECT_EXTENSION,
+ support::ESCAPE_DOTS);
+ result = subst_path(result, "$$RelPathParent",
+ relToParentPath, use_latex_path,
+ support::PROTECT_EXTENSION,
+ support::ESCAPE_DOTS);
+ if (support::absolutePath(filename)) {
+ result = subst_path(result, "$$AbsOrRelPathMaster",
+ abspath, use_latex_path,
+ support::PROTECT_EXTENSION,
+ support::ESCAPE_DOTS);
+ result = subst_path(result, "$$AbsOrRelPathParent",
+ abspath, use_latex_path,
+ support::PROTECT_EXTENSION,
+ support::ESCAPE_DOTS);
+ } else {
+ result = subst_path(result, "$$AbsOrRelPathMaster",
+ relToMasterPath, use_latex_path,
+ support::PROTECT_EXTENSION,
+ support::ESCAPE_DOTS);
+ result = subst_path(result, "$$AbsOrRelPathParent",
+ relToParentPath, use_latex_path,
+ support::PROTECT_EXTENSION,
+ support::ESCAPE_DOTS);
+ }
+ }