]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Add outline-in/out/up/down to the outline context menu.
[lyx.git] / src / Buffer.cpp
index 9970af3181b78566a5c00b3746b55dab74d624f0..bc3585ebe9bb57856bf8fdb496aaf303d98b5157 100644 (file)
@@ -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);
 }