mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
BugFix: remove session filename from list or recent files if failed
loading.
This commit is contained in:
@@ -27,8 +27,10 @@ std::string SessionCreator::info(const std::string& filename)
|
||||
|
||||
XMLDocument doc;
|
||||
XMLError eResult = doc.LoadFile(filename.c_str());
|
||||
if ( XMLResultError(eResult))
|
||||
if ( XMLResultError(eResult)) {
|
||||
Log::Warning("%s could not be openned.", filename.c_str());
|
||||
return ret;
|
||||
}
|
||||
|
||||
XMLElement *header = doc.FirstChildElement(APP_NAME);
|
||||
if (header != nullptr && header->Attribute("date") != 0) {
|
||||
@@ -50,8 +52,10 @@ SessionCreator::SessionCreator(): SessionLoader(nullptr)
|
||||
void SessionCreator::load(const std::string& filename)
|
||||
{
|
||||
XMLError eResult = xmlDoc_.LoadFile(filename.c_str());
|
||||
if ( XMLResultError(eResult))
|
||||
if ( XMLResultError(eResult)){
|
||||
Log::Warning("%s could not be openned.", filename.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
XMLElement *header = xmlDoc_.FirstChildElement(APP_NAME);
|
||||
if (header == nullptr) {
|
||||
|
||||
@@ -2406,6 +2406,14 @@ void Navigator::RenderMainPannel()
|
||||
}
|
||||
else {
|
||||
file_info = SessionCreator::info(sessionfilename);
|
||||
if (file_info.empty()) {
|
||||
// failed : remove from recent
|
||||
if ( selection_session_mode == 0) {
|
||||
Settings::application.recentSessions.filenames.remove(sessionfilename);
|
||||
selection_session_mode_changed = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
file_selected = it;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ bool tinyxml2::XMLResultError(int result)
|
||||
XMLError xmlresult = (XMLError) result;
|
||||
if ( xmlresult != XML_SUCCESS)
|
||||
{
|
||||
Log::Warning("XML error %i: %s", result, tinyxml2::XMLDocument::ErrorIDToName(xmlresult));
|
||||
Log::Info("XML error %i: %s", result, tinyxml2::XMLDocument::ErrorIDToName(xmlresult));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user