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