From 815e655a5e8a35bb95606005825940c34cf56b4f Mon Sep 17 00:00:00 2001 From: Leland Lucius Date: Wed, 3 Jun 2020 22:35:57 -0500 Subject: [PATCH] Bug 2470 - Modules may not be found if earlier version failed --- src/prefs/ModulePrefs.cpp | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/prefs/ModulePrefs.cpp b/src/prefs/ModulePrefs.cpp index 39d442442..5fb96b462 100644 --- a/src/prefs/ModulePrefs.cpp +++ b/src/prefs/ModulePrefs.cpp @@ -169,13 +169,28 @@ int ModulePrefs::GetModuleStatus(const FilePath &fname){ // Default status is NEW module, and we will ask once. int iStatus = kModuleNew; - wxString ShortName = wxFileName( fname ).GetName(); - wxString PrefName = wxString( wxT("/Module/") ) + ShortName.Lower(); + wxString ShortName = wxFileName( fname ).GetName().Lower(); + wxString PathPref = wxString( wxT("/ModulePath/") ) + ShortName; + wxString StatusPref = wxString( wxT("/Module/") ) + ShortName; + + wxString ModulePath = gPrefs->Read( PathPref, wxEmptyString ); + if( ModulePath.IsSameAs( fname ) ) + { + gPrefs->Read( StatusPref, &iStatus, kModuleNew ); + + // fix up a bad status. + if( iStatus > kModuleNew ) + { + iStatus=kModuleNew; + } + } + else + { + // Remove previously saved since it's no longer valid + gPrefs->DeleteEntry( PathPref ); + gPrefs->DeleteEntry( StatusPref ); + } - gPrefs->Read( PrefName, &iStatus, kModuleNew ); - // fix up a bad status. - if( iStatus > kModuleNew ) - iStatus=kModuleNew; return iStatus; }