Simplify use of Buffer::getBackupName().

Previous versions of this code used the string in a different way,
but now it is sufficient just to return a FileName.
This commit is contained in:
Richard Heck 2015-11-13 17:12:52 -05:00
parent 5060b5b76e
commit 9efa43d2be
2 changed files with 5 additions and 8 deletions

View File

@ -1306,7 +1306,7 @@ Buffer::ReadStatus Buffer::convertLyXFormat(FileName const & fn,
}
string Buffer::getBackupName() const {
FileName Buffer::getBackupName() const {
FileName const & fn = fileName();
string const fname = fn.onlyFileNameWithoutExt();
string const fext = fn.extension();
@ -1337,7 +1337,7 @@ string Buffer::getBackupName() const {
backup.set(addName(fpath, addExtension(newbackname, fext)));
v++;
}
return v < 100 ? backup.absFileName() : "";
return v < 100 ? backup : FileName();
}
@ -1402,11 +1402,8 @@ bool Buffer::save() const
FileName backupName;
if (lyxrc.make_backup || d->need_format_backup) {
if (d->need_format_backup) {
string backup_name = getBackupName();
if (!backup_name.empty())
backupName.set(backup_name);
}
if (d->need_format_backup)
backupName = getBackupName();
// If we for some reason failed to find a backup name in case of
// a format change, this will still set one. It's the best we can

View File

@ -268,7 +268,7 @@ private:
ReadStatus convertLyXFormat(support::FileName const & fn,
support::FileName & tmpfile, int from_format);
/// get appropriate name for backing up files from older versions
std::string getBackupName() const;
support::FileName getBackupName() const;
//@}
public: