mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-27 06:19:36 +00:00
Fix up a few little things after r29065. If we're calculating the autosave
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
This commit is contained in:
parent
dd8a3f6f83
commit
876dc0d54e
@ -930,7 +930,7 @@ bool Buffer::writeFile(FileName const & fname) const
|
||||
return false;
|
||||
}
|
||||
|
||||
removeAutosaveFile(d->filename.absFilename());
|
||||
removeAutosaveFile();
|
||||
|
||||
saveCheckSum(d->filename);
|
||||
message(str + _(" done."));
|
||||
@ -2423,6 +2423,22 @@ int AutoSaveBuffer::generateChild()
|
||||
} // 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
|
||||
{
|
||||
@ -2434,13 +2450,7 @@ 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();
|
||||
|
@ -456,6 +456,8 @@ public:
|
||||
|
||||
///
|
||||
void autoSave() const;
|
||||
///
|
||||
void removeAutosaveFile() const;
|
||||
|
||||
/// return the format of the buffer on a string
|
||||
std::string bufferFormat() const;
|
||||
@ -520,6 +522,8 @@ private:
|
||||
*/
|
||||
ReadStatus readFile(Lexer &, support::FileName const & filename,
|
||||
bool fromString = false);
|
||||
///
|
||||
support::FileName getAutosaveFilename() const;
|
||||
|
||||
/// Use the Pimpl idiom to hide the internals.
|
||||
class Impl;
|
||||
|
@ -1908,7 +1908,7 @@ bool GuiView::closeBuffer(Buffer & buf, bool tolastopened)
|
||||
// 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;
|
||||
|
@ -837,18 +837,6 @@ FileName const findtexfile(string const & fil, string const & /*format*/)
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -250,9 +250,6 @@ bool readLink(FileName const & file, FileName & link);
|
||||
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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user