From 6f68bfcf7119917153f1e3080dc8138aca412fe7 Mon Sep 17 00:00:00 2001 From: Fabrice de Gans Date: Thu, 1 Jun 2023 11:18:59 -0700 Subject: [PATCH] Create the config directory at first launch First launch would fail because wx does not create the configuration directory by itself if it does not exist. This also fixes an incorrect menu option. --- src/wx/cmdevents.cpp | 2 +- src/wx/wxvbam.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wx/cmdevents.cpp b/src/wx/cmdevents.cpp index 56ed9d1c..792f43cc 100644 --- a/src/wx/cmdevents.cpp +++ b/src/wx/cmdevents.cpp @@ -2608,7 +2608,7 @@ EVT_HANDLER(SpeedOn, "Enable faster network protocol by default") EVT_HANDLER(LinkProto, "Local host IPC") { - GetMenuOptionConfig("LinkProto", config::OptionID::kGBALinkHost); + GetMenuOptionConfig("LinkProto", config::OptionID::kGBALinkProto); } EVT_HANDLER(LinkConfigure, "Link options...") diff --git a/src/wx/wxvbam.cpp b/src/wx/wxvbam.cpp index b3ed8ba3..d1df3598 100644 --- a/src/wx/wxvbam.cpp +++ b/src/wx/wxvbam.cpp @@ -406,6 +406,11 @@ bool wxvbamApp::OnInit() { config_file_.GetFullPath(), wxEmptyString, wxCONFIG_USE_LOCAL_FILE)); + // wx does not create the directories by itself so do it here, if needed. + if (!wxDirExists(config_file_.GetPath())) { + config_file_.Mkdir(wxS_DIR_DEFAULT, wxPATH_MKDIR_FULL); + } + // Load the default options. load_opts(!config_file_.Exists());