From: Toni Wilen Date: Tue, 23 Apr 2024 17:31:01 +0000 (+0300) Subject: Do not reset config to default if config file can't be opened. X-Git-Tag: 5300~30 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=8c4bc7bba4c43286eeb6faca51c25ddb431fbb7c;p=francis%2Fwinuae.git Do not reset config to default if config file can't be opened. --- diff --git a/od-win32/win32gui.cpp b/od-win32/win32gui.cpp index ef605821..36cd8195 100644 --- a/od-win32/win32gui.cpp +++ b/od-win32/win32gui.cpp @@ -4249,7 +4249,24 @@ static TCHAR *HandleConfiguration (HWND hDlg, int flag, struct ConfigStruct *con TCHAR szMessage[MAX_DPATH]; WIN32GUI_LoadUIString (IDS_MUSTSELECTCONFIG, szMessage, MAX_DPATH); pre_gui_message (szMessage); - } else { + ok = 0; + } + if (ok && !zfile_exists(path)) { + TCHAR fname[MAX_DPATH]; + fetch_configurationpath(fname, sizeof(fname) / sizeof(TCHAR)); + if (_tcsncmp(fname, path, _tcslen(fname))) + _tcscat(fname, path); + else + _tcscpy(fname, path); + if (!zfile_exists(fname)) { + TCHAR szMessage[MAX_DPATH]; + WIN32GUI_LoadUIString(IDS_COULDNOTLOADCONFIG, szMessage, MAX_DPATH); + pre_gui_message(szMessage); + config_filename[0] = 0; + ok = 0; + } + } + if (ok) { if (target_cfgfile_load (&workprefs, path, configtypepanel, 0) == 0) { TCHAR szMessage[MAX_DPATH]; WIN32GUI_LoadUIString (IDS_COULDNOTLOADCONFIG, szMessage, MAX_DPATH);