mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-11 03:03:06 +00:00
Fix bug #5879: Move the autosave file of a buffer when the filename changes (patch by Richard).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29505 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3045d9b4ff
commit
dce037ed5a
@ -491,9 +491,17 @@ void Buffer::setReadonly(bool const flag)
|
||||
|
||||
void Buffer::setFileName(string const & newfile)
|
||||
{
|
||||
// bring the autosave file with us, just in case.
|
||||
FileName const oldauto = getAutosaveFilename();
|
||||
d->filename = makeAbsPath(newfile);
|
||||
setReadonly(d->filename.isReadOnly());
|
||||
updateTitles();
|
||||
FileName const newauto = getAutosaveFilename();
|
||||
if (oldauto == newauto)
|
||||
return;
|
||||
if (oldauto.moveTo(newauto))
|
||||
return;
|
||||
LYXERR0("Unable to remove autosave file `" << oldauto << "'!");
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user