From f96293d1e8d33b55a2557159888363fc7473b693 Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 22 Apr 2015 18:53:03 -0300 Subject: [PATCH] Recover files with other filename to avoid confusion (related to #637) --- src/app/crash/session.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/app/crash/session.cpp b/src/app/crash/session.cpp index 3b90829fe..a9c833536 100644 --- a/src/app/crash/session.cpp +++ b/src/app/crash/session.cpp @@ -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);