mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-31 07:59:27 +02:00
Bug 2470 - Linux/Mac: Modules may not be found if earlier version failed
This commit is contained in:
parent
4334a656b0
commit
f3d3211558
@ -260,6 +260,7 @@ void ModuleManager::Initialize(CommandHandler &cmdHandler)
|
||||
FileNames::FindFilesInPathList(wxT("*.so"), pathList, files);
|
||||
#endif
|
||||
|
||||
FilePaths checked;
|
||||
wxString saveOldCWD = ::wxGetCwd();
|
||||
for (i = 0; i < files.size(); i++) {
|
||||
// As a courtesy to some modules that might be bridges to
|
||||
@ -268,6 +269,13 @@ void ModuleManager::Initialize(CommandHandler &cmdHandler)
|
||||
auto prefix = ::wxPathOnly(files[i]);
|
||||
::wxSetWorkingDirectory(prefix);
|
||||
|
||||
// Only process the first module encountered in the
|
||||
// defined search sequence.
|
||||
wxString ShortName = wxFileName( files[i] ).GetName();
|
||||
if( checked.Index( ShortName, false ) != wxNOT_FOUND )
|
||||
continue;
|
||||
checked.Add( ShortName );
|
||||
|
||||
#ifdef EXPERIMENTAL_MODULE_PREFS
|
||||
int iModuleStatus = ModulePrefs::GetModuleStatus( files[i] );
|
||||
if( iModuleStatus == kModuleDisabled )
|
||||
@ -288,7 +296,6 @@ void ModuleManager::Initialize(CommandHandler &cmdHandler)
|
||||
// I think it would be better to show the module prefs page,
|
||||
// and let the user decide for each one.
|
||||
{
|
||||
wxString ShortName = wxFileName( files[i] ).GetName();
|
||||
auto msg = XO("Module \"%s\" found.").Format( ShortName );
|
||||
msg += XO("\n\nOnly use modules from trusted sources");
|
||||
const TranslatableStrings buttons{
|
||||
|
@ -165,21 +165,29 @@ bool ModulePrefs::Commit()
|
||||
|
||||
|
||||
// static function that tells us about a module.
|
||||
int ModulePrefs::GetModuleStatus(const FilePath &fname){
|
||||
int ModulePrefs::GetModuleStatus(const FilePath &fname)
|
||||
{
|
||||
// Default status is NEW module, and we will ask once.
|
||||
int iStatus = kModuleNew;
|
||||
|
||||
wxString ShortName = wxFileName( fname ).GetName().Lower();
|
||||
wxFileName FileName( fname );
|
||||
wxDateTime DateTime = FileName.GetModificationTime();
|
||||
wxString ShortName = FileName.GetName().Lower();
|
||||
|
||||
wxString PathPref = wxString( wxT("/ModulePath/") ) + ShortName;
|
||||
wxString StatusPref = wxString( wxT("/Module/") ) + ShortName;
|
||||
wxString DateTimePref = wxString( wxT("/ModuleDateTime/") ) + ShortName;
|
||||
|
||||
wxString ModulePath = gPrefs->Read( PathPref, wxEmptyString );
|
||||
if( ModulePath.IsSameAs( fname ) )
|
||||
{
|
||||
gPrefs->Read( StatusPref, &iStatus, kModuleNew );
|
||||
|
||||
// fix up a bad status.
|
||||
if( iStatus > kModuleNew )
|
||||
wxDateTime OldDateTime;
|
||||
OldDateTime.ParseISOCombined( gPrefs->Read( DateTimePref, wxEmptyString ) );
|
||||
|
||||
// fix up a bad status or reset for newer module
|
||||
if( iStatus > kModuleNew || !OldDateTime.IsEqualTo( DateTime ) )
|
||||
{
|
||||
iStatus=kModuleNew;
|
||||
}
|
||||
@ -189,17 +197,27 @@ int ModulePrefs::GetModuleStatus(const FilePath &fname){
|
||||
// Remove previously saved since it's no longer valid
|
||||
gPrefs->DeleteEntry( PathPref );
|
||||
gPrefs->DeleteEntry( StatusPref );
|
||||
gPrefs->DeleteEntry( DateTimePref );
|
||||
}
|
||||
|
||||
return iStatus;
|
||||
}
|
||||
|
||||
void ModulePrefs::SetModuleStatus(const FilePath &fname, int iStatus){
|
||||
wxString ShortName = wxFileName( fname ).GetName();
|
||||
wxString PrefName = wxString( wxT("/Module/") ) + ShortName.Lower();
|
||||
void ModulePrefs::SetModuleStatus(const FilePath &fname, int iStatus)
|
||||
{
|
||||
wxFileName FileName( fname );
|
||||
wxDateTime DateTime = FileName.GetModificationTime();
|
||||
wxString ShortName = FileName.GetName().Lower();
|
||||
|
||||
wxString PrefName = wxString( wxT("/Module/") ) + ShortName;
|
||||
gPrefs->Write( PrefName, iStatus );
|
||||
PrefName = wxString( wxT("/ModulePath/") ) + ShortName.Lower();
|
||||
|
||||
PrefName = wxString( wxT("/ModulePath/") ) + ShortName;
|
||||
gPrefs->Write( PrefName, fname );
|
||||
|
||||
PrefName = wxString( wxT("/ModuleDateTime/") ) + ShortName;
|
||||
gPrefs->Write( PrefName, DateTime.FormatISOCombined() );
|
||||
|
||||
gPrefs->Flush();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user