Fixed the "Could not set current working directory" log that would appear on boot when there was no xrc sub-directory present.

This commit is contained in:
skidau 2015-05-06 10:10:04 +00:00
parent 9c35a933d9
commit f7e352d5a4
1 changed files with 3 additions and 4 deletions

View File

@ -97,16 +97,15 @@ bool wxvbamApp::OnInit()
xr->Load(wxT("*.xrs")); xr->Load(wxT("*.xrs"));
} }
if (wxSetWorkingDirectory(wxStandardPaths::Get().GetPluginsDir() + wxT("\\xrc"))) { wxString xrcDir = wxStandardPaths::Get().GetPluginsDir() + wxT("\\xrc");
if (!wxFindFirstFile(wxT("*.xrc")).empty()) if (wxDirExists(xrcDir) && wxSetWorkingDirectory(xrcDir) && !wxFindFirstFile(wxT("*.xrc")).empty()) {
xr->Load(wxT("*.xrc")); xr->Load(wxT("*.xrc"));
} }
else { else {
// finally, load built-in xrc // finally, load built-in xrc
xr->Load(wxT("memory:wxvbam.xrs")); xr->Load(wxT("memory:wxvbam.xrs"));
} }
wxSetWorkingDirectory(cwd); wxSetWorkingDirectory(cwd);
// set up config file // set up config file