filename in a different way, we need to make sure we always do it the same
way. Makes more sense to do this in Buffer anyway.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29073
a592a061-630c-0410-9148-
cb99ea01b6c8
return false;
}
- removeAutosaveFile(d->filename.absFilename());
+ removeAutosaveFile();
saveCheckSum(d->filename);
message(str + _(" done."));
} // namespace anon
+FileName Buffer::getAutosaveFilename() const
+{
+ string const fpath = isUnnamed() ? lyxrc.document_path : filePath();
+ string const fname = "#" + d->filename.onlyFileName() + "#";
+ return makeAbsPath(fname, fpath);
+}
+
+
+void Buffer::removeAutosaveFile() const
+{
+ FileName const f = getAutosaveFilename();
+ if (f.exists())
+ f.removeFile();
+}
+
+
// Perfect target for a thread...
void Buffer::autoSave() const
{
// emit message signal.
message(_("Autosaving current document..."));
-
- // create autosave filename
- string fpath = isUnnamed() ? lyxrc.document_path : filePath();
- string fname = "#" + d->filename.onlyFileName() + "#";
- FileName file_name = makeAbsPath(fname, fpath);
-
- AutoSaveBuffer autosave(*this, file_name);
+ AutoSaveBuffer autosave(*this, getAutosaveFilename());
autosave.start();
markBakClean();
///
void autoSave() const;
+ ///
+ void removeAutosaveFile() const;
/// return the format of the buffer on a string
std::string bufferFormat() const;
*/
ReadStatus readFile(Lexer &, support::FileName const & filename,
bool fromString = false);
+ ///
+ support::FileName getAutosaveFilename() const;
/// Use the Pimpl idiom to hide the internals.
class Impl;
// if we crash after this we could
// have no autosave file but I guess
// this is really improbable (Jug)
- removeAutosaveFile(buf.absFileName());
+ buf.removeAutosaveFile();
break;
case 2:
return false;
}
-void removeAutosaveFile(string const & filename)
-{
- string a = onlyPath(filename);
- a += '#';
- a += onlyFilename(filename);
- a += '#';
- FileName const autosave(a);
- if (autosave.exists())
- autosave.removeFile();
-}
-
-
void readBB_lyxerrMessage(FileName const & file, bool & zipped,
string const & message)
{
FileName const findtexfile(std::string const & fil,
std::string const & format);
-/// remove the autosave-file and give a Message if it can't be done
-void removeAutosaveFile(std::string const & filename);
-
/// read the BoundingBox entry from a ps/eps/pdf-file
std::string const readBB_from_PSFile(FileName const & file);