mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
prompt with error messageboxes for problems when reading init files
svn path=/trunk/; revision=9435
This commit is contained in:
parent
9c4dd6241a
commit
4b62bbcaa8
3 changed files with 22 additions and 7 deletions
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue