mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
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:
parent
5060b5b76e
commit
9efa43d2be
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user