From af39d35545295820d0702dcfb340cf8df3c04404 Mon Sep 17 00:00:00 2001 From: Vincent van Ravesteijn Date: Sun, 3 May 2009 10:24:12 +0000 Subject: [PATCH] Adjust the location of the autosave file for unnamed docs. If the document is unnamed try to save in the backup dir, else in the default document path, and as a last try in the filePath, which will most often be the temporary directory. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29508 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Buffer.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 9970af3181..bc3585ebe9 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -2607,7 +2607,16 @@ int AutoSaveBuffer::generateChild() FileName Buffer::getAutosaveFilename() const { - string const fpath = isUnnamed() ? lyxrc.document_path : filePath(); + // if the document is unnamed try to save in the backup dir, else + // in the default document path, and as a last try in the filePath, + // which will most often be the temporary directory + string fpath; + if (isUnnamed()) + fpath = lyxrc.backupdir_path.empty() ? lyxrc.document_path + : lyxrc.backupdir_path; + if (!isUnnamed() || fpath.empty() || !FileName(fpath).exists()) + fpath = filePath(); + string const fname = "#" + d->filename.onlyFileName() + "#"; return makeAbsPath(fname, fpath); } -- 2.39.2