From 0087bd7076c58091f616aa919fc6a86cb31ac2c8 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. git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@1394 a31d4220-a93d-0410-bf67-fe4944624d44 --- 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