protected:
// Scans the resources list for unloaded files and loads them. Also reloads
// files that have been modified since last loading.
- void UpdateResources();
+ bool UpdateResources();
// Finds a resource (calls UpdateResources) and returns a node containing it.
wxXmlNode *FindResource(const wxString& name, const wxString& classname, bool recursive = FALSE);
}
# undef wxXmlFindFirst
# undef wxXmlFindNext
- return rt;
+ return rt && UpdateResources();
}
-void wxXmlResource::UpdateResources()
+bool wxXmlResource::UpdateResources()
{
+ bool rt = true;
bool modif;
# if wxUSE_FILESYSTEM
wxFSFile *file = NULL;
file = fsys.OpenFile(m_data[i].File);
modif = file && file->GetModificationTime() > m_data[i].Time;
if (!file)
+ {
wxLogError(_("Cannot open file '%s'."), m_data[i].File.c_str());
+ rt = false;
+ }
wxDELETE(file);
# else
modif = wxDateTime(wxFileModificationTime(m_data[i].File)) > m_data[i].Time;
wxLogError(_("Cannot load resources from file '%s'."),
m_data[i].File.c_str());
wxDELETE(m_data[i].Doc);
+ rt = false;
}
else if (m_data[i].Doc->GetRoot()->GetName() != wxT("resource"))
{
wxLogError(_("Invalid XRC resource '%s': doesn't have root node 'resource'."), m_data[i].File.c_str());
wxDELETE(m_data[i].Doc);
+ rt = false;
}
else
{
if (m_version == -1)
m_version = version;
if (m_version != version)
+ {
wxLogError(_("Resource files must have same version number!"));
+ rt = false;
+ }
ProcessPlatformProperty(m_data[i].Doc->GetRoot());
m_data[i].Time = file->GetModificationTime();
# endif
}
}
+
+ return rt;
}
protected:
// Scans the resources list for unloaded files and loads them. Also reloads
// files that have been modified since last loading.
- void UpdateResources();
+ bool UpdateResources();
// Finds a resource (calls UpdateResources) and returns a node containing it.
wxXmlNode *FindResource(const wxString& name, const wxString& classname, bool recursive = FALSE);
}
# undef wxXmlFindFirst
# undef wxXmlFindNext
- return rt;
+ return rt && UpdateResources();
}
-void wxXmlResource::UpdateResources()
+bool wxXmlResource::UpdateResources()
{
+ bool rt = true;
bool modif;
# if wxUSE_FILESYSTEM
wxFSFile *file = NULL;
file = fsys.OpenFile(m_data[i].File);
modif = file && file->GetModificationTime() > m_data[i].Time;
if (!file)
+ {
wxLogError(_("Cannot open file '%s'."), m_data[i].File.c_str());
+ rt = false;
+ }
wxDELETE(file);
# else
modif = wxDateTime(wxFileModificationTime(m_data[i].File)) > m_data[i].Time;
wxLogError(_("Cannot load resources from file '%s'."),
m_data[i].File.c_str());
wxDELETE(m_data[i].Doc);
+ rt = false;
}
else if (m_data[i].Doc->GetRoot()->GetName() != wxT("resource"))
{
wxLogError(_("Invalid XRC resource '%s': doesn't have root node 'resource'."), m_data[i].File.c_str());
wxDELETE(m_data[i].Doc);
+ rt = false;
}
else
{
if (m_version == -1)
m_version = version;
if (m_version != version)
+ {
wxLogError(_("Resource files must have same version number!"));
+ rt = false;
+ }
ProcessPlatformProperty(m_data[i].Doc->GetRoot());
m_data[i].Time = file->GetModificationTime();
# endif
}
}
+
+ return rt;
}