Recover files with other filename to avoid confusion (related to #637)

This commit is contained in:
David Capello 2015-04-22 18:53:03 -03:00
parent aeb1a799d7
commit f96293d1e8

View File

@ -169,8 +169,21 @@ void Session::restoreBackup(Backup* backup)
Console console;
try {
app::Document* doc = read_document(backup->dir());
if (doc)
if (doc) {
std::string fn = doc->filename();
if (!fn.empty()) {
std::string ext = base::get_file_extension(fn);
if (!ext.empty())
ext = "." + ext;
doc->setFilename(
base::join_path(
base::get_file_path(fn),
base::get_file_title(fn) + "-Recovered" + ext));
}
UIContext::instance()->documents().add(doc);
}
}
catch (const std::exception& ex) {
Console::showException(ex);