diff --git a/reactos/subsys/system/explorer/explorer.cpp b/reactos/subsys/system/explorer/explorer.cpp index e415bb2eeb7..fb55a7c808c 100644 --- a/reactos/subsys/system/explorer/explorer.cpp +++ b/reactos/subsys/system/explorer/explorer.cpp @@ -82,8 +82,13 @@ void ExplorerGlobals::read_persistent() _cfg_dir.printf(TEXT("%s\\ReactOS"), (LPCTSTR)SpecialFolderFSPath(CSIDL_APPDATA,0)); _cfg_path.printf(TEXT("%s\\ros-explorer-cfg.xml"), _cfg_dir.c_str()); - if (!_cfg.read(_cfg_path)) + if (!_cfg.read(_cfg_path)) { + if (_cfg._last_error != XML_ERROR_NO_ELEMENTS) + MessageBox(g_Globals._hwndDesktop, String(_cfg._last_error_msg.c_str()), + TEXT("ROS Explorer - reading user settings"), MB_OK); + _cfg.read(TEXT("explorer-cfg-template.xml")); + } // read bookmarks _favorites_path.printf(TEXT("%s\\ros-explorer-bookmarks.xml"), _cfg_dir.c_str()); diff --git a/reactos/subsys/system/explorer/taskbar/favorites.cpp b/reactos/subsys/system/explorer/taskbar/favorites.cpp index 330cad2a9ad..c10af859cfb 100644 --- a/reactos/subsys/system/explorer/taskbar/favorites.cpp +++ b/reactos/subsys/system/explorer/taskbar/favorites.cpp @@ -427,7 +427,11 @@ bool Favorites::read(LPCTSTR path) XMLDoc xbel; if (!xbel.read(path)) - return false; + if (xbel._last_error == XML_ERROR_NO_ELEMENTS) + return false; + else + MessageBox(g_Globals._hwndDesktop, String(xbel._last_error_msg.c_str()), + TEXT("ROS Explorer - reading bookmark file"), MB_OK); const_XMLPos pos(&xbel); diff --git a/reactos/subsys/system/explorer/utility/xmlstorage.h b/reactos/subsys/system/explorer/utility/xmlstorage.h index 7af85de3a07..910f8bb3b3e 100644 --- a/reactos/subsys/system/explorer/utility/xmlstorage.h +++ b/reactos/subsys/system/explorer/utility/xmlstorage.h @@ -1232,6 +1232,7 @@ struct XMLReader return out.str(); } + XML_Error get_error_code() {return XML_GetErrorCode(_parser);} std::string get_error_string() const; protected: @@ -1276,12 +1277,14 @@ struct XMLHeader : public std::string struct XMLDoc : public XMLNode { XMLDoc() - : XMLNode("") + : XMLNode(""), + _last_error(XML_ERROR_NONE) { } XMLDoc(LPCTSTR path) - : XMLNode("") + : XMLNode(""), + _last_error(XML_ERROR_NONE) { read(path); } @@ -1297,7 +1300,8 @@ struct XMLDoc : public XMLNode out << reader.get_position() << " " << reader.get_error_string(); - _last_error = out.str(); + _last_error = reader.get_error_code(); + _last_error_msg = out.str(); } return in; @@ -1315,7 +1319,8 @@ struct XMLDoc : public XMLNode out << path << reader.get_position() << " " << reader.get_error_string(); - _last_error = out.str(); + _last_error = reader.get_error_code(); + _last_error_msg = out.str(); } return status != XML_STATUS_ERROR; @@ -1352,7 +1357,8 @@ struct XMLDoc : public XMLNode write_formating(out); } - std::string _last_error; + XML_Error _last_error; + std::string _last_error_msg; };