mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
Improve directory name juggling
The old code did not ensure that the path was only broken into parts at directory separators. The new code ensures it.
This commit is contained in:
parent
b5c693eb0f
commit
9267f177b9
@ -1020,11 +1020,10 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
|
|||||||
// so we can catch also eventually used symbolic parts of the path.
|
// so we can catch also eventually used symbolic parts of the path.
|
||||||
string filepath = buf->fileName().onlyPath().realPath();
|
string filepath = buf->fileName().onlyPath().realPath();
|
||||||
string const sysdir = package().system_support().realPath();
|
string const sysdir = package().system_support().realPath();
|
||||||
if (prefixIs(filepath, sysdir)) {
|
string const relpath =
|
||||||
filepath.replace(0, sysdir.length(), "/systemlyxdir/");
|
to_utf8(makeRelPath(from_utf8(filepath), from_utf8(sysdir)));
|
||||||
// Remove eventually added superfluous "/"
|
if (!prefixIs(relpath, "../") && !FileName::isAbsolute(relpath))
|
||||||
filepath = subst(filepath, "//", "/");
|
filepath = addPath("/systemlyxdir", relpath);
|
||||||
}
|
|
||||||
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