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;
|
XMLDocument doc;
|
||||||
XMLError eResult = doc.LoadFile(filename.c_str());
|
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;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
XMLElement *header = doc.FirstChildElement(APP_NAME);
|
XMLElement *header = doc.FirstChildElement(APP_NAME);
|
||||||
if (header != nullptr && header->Attribute("date") != 0) {
|
if (header != nullptr && header->Attribute("date") != 0) {
|
||||||
@@ -50,8 +52,10 @@ SessionCreator::SessionCreator(): SessionLoader(nullptr)
|
|||||||
void SessionCreator::load(const std::string& filename)
|
void SessionCreator::load(const std::string& filename)
|
||||||
{
|
{
|
||||||
XMLError eResult = xmlDoc_.LoadFile(filename.c_str());
|
XMLError eResult = xmlDoc_.LoadFile(filename.c_str());
|
||||||
if ( XMLResultError(eResult))
|
if ( XMLResultError(eResult)){
|
||||||
|
Log::Warning("%s could not be openned.", filename.c_str());
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
XMLElement *header = xmlDoc_.FirstChildElement(APP_NAME);
|
XMLElement *header = xmlDoc_.FirstChildElement(APP_NAME);
|
||||||
if (header == nullptr) {
|
if (header == nullptr) {
|
||||||
|
|||||||
@@ -2406,7 +2406,15 @@ void Navigator::RenderMainPannel()
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
file_info = SessionCreator::info(sessionfilename);
|
file_info = SessionCreator::info(sessionfilename);
|
||||||
file_selected = it;
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
|
|||||||
@@ -221,7 +221,7 @@ bool tinyxml2::XMLResultError(int result)
|
|||||||
XMLError xmlresult = (XMLError) result;
|
XMLError xmlresult = (XMLError) result;
|
||||||
if ( xmlresult != XML_SUCCESS)
|
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 true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user