mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
\origin handling. Use realPath() intead of absFileName()
This change avoids misinterpreting paths containing symbolic parts. Without this, lyx may not find its own sysdir.
This commit is contained in:
parent
3ac20d7689
commit
f7a8c5b4eb
@ -1016,10 +1016,15 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
|
|||||||
// Prints out the buffer info into the .lyx file given by file
|
// Prints out the buffer info into the .lyx file given by file
|
||||||
|
|
||||||
// the document directory
|
// the document directory
|
||||||
string filepath = buf->filePath();
|
// use realPath() instead of absFileName() for comparing
|
||||||
string const sysdir = package().system_support().absFileName();
|
// so we can catch also eventually used symbolic parts of the path.
|
||||||
if (prefixIs(filepath, sysdir))
|
string filepath = buf->fileName().onlyPath().realPath();
|
||||||
|
string const sysdir = package().system_support().realPath();
|
||||||
|
if (prefixIs(filepath, sysdir)) {
|
||||||
filepath.replace(0, sysdir.length(), "/systemlyxdir/");
|
filepath.replace(0, sysdir.length(), "/systemlyxdir/");
|
||||||
|
// Remove eventually added superfluous "/"
|
||||||
|
filepath = subst(filepath, "//", "/");
|
||||||
|
}
|
||||||
else if (!lyxrc.save_origin)
|
else if (!lyxrc.save_origin)
|
||||||
filepath = "unavailable";
|
filepath = "unavailable";
|
||||||
os << "\\origin " << quoteIfNeeded(filepath) << '\n';
|
os << "\\origin " << quoteIfNeeded(filepath) << '\n';
|
||||||
|
Loading…
Reference in New Issue
Block a user