From f7e352d5a4d96f02ca87294b7b7fc381ca8aa96c Mon Sep 17 00:00:00 2001 From: skidau Date: Wed, 6 May 2015 10:10:04 +0000 Subject: [PATCH] Fixed the "Could not set current working directory" log that would appear on boot when there was no xrc sub-directory present. --- src/wx/wxvbam.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/wx/wxvbam.cpp b/src/wx/wxvbam.cpp index 09e1e8c3..1fa90314 100644 --- a/src/wx/wxvbam.cpp +++ b/src/wx/wxvbam.cpp @@ -97,16 +97,15 @@ bool wxvbamApp::OnInit() xr->Load(wxT("*.xrs")); } - if (wxSetWorkingDirectory(wxStandardPaths::Get().GetPluginsDir() + wxT("\\xrc"))) { - if (!wxFindFirstFile(wxT("*.xrc")).empty()) - xr->Load(wxT("*.xrc")); + wxString xrcDir = wxStandardPaths::Get().GetPluginsDir() + wxT("\\xrc"); + if (wxDirExists(xrcDir) && wxSetWorkingDirectory(xrcDir) && !wxFindFirstFile(wxT("*.xrc")).empty()) { + xr->Load(wxT("*.xrc")); } else { // finally, load built-in xrc xr->Load(wxT("memory:wxvbam.xrs")); } - wxSetWorkingDirectory(cwd); // set up config file