mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-21 08:27:13 +01:00
Bug2135: startup should not fail quietly when audacity.cfg is locked...
simplest fix is simply to put up a message box explaining it
This commit is contained in:
@@ -1360,6 +1360,13 @@ bool AudacityApp::OnInit()
|
||||
// Initialize preferences and language
|
||||
InitPreferences();
|
||||
PopulatePreferences();
|
||||
// This test must follow PopulatePreferences, because if an error message
|
||||
// must be shown, we need internationalization to have been initialized
|
||||
// first, which was done in PopulatePreferences
|
||||
if ( !CheckWritablePreferences() ) {
|
||||
::AudacityMessageBox( UnwritablePreferencesErrorMessage() );
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__) && !defined(__CYGWIN__)
|
||||
this->AssociateFileTypes();
|
||||
|
||||
@@ -61,6 +61,7 @@
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
#include "FileNames.h"
|
||||
#include "Internat.h"
|
||||
#include "MemoryX.h"
|
||||
#include "Languages.h"
|
||||
|
||||
@@ -220,6 +221,20 @@ void InitPreferences()
|
||||
wxConfigBase::Set(gPrefs);
|
||||
}
|
||||
|
||||
bool CheckWritablePreferences()
|
||||
{
|
||||
return gPrefs->Write("/TEST", true) && gPrefs->Flush();
|
||||
}
|
||||
|
||||
wxString UnwritablePreferencesErrorMessage()
|
||||
{
|
||||
wxFileName configFileName(FileNames::DataDir(), wxT("audacity.cfg"));
|
||||
return wxString::Format(
|
||||
_("Audacity cannot start because the settings file at %s is not writable."),
|
||||
configFileName.GetFullPath()
|
||||
);
|
||||
}
|
||||
|
||||
void FinishPreferences()
|
||||
{
|
||||
if (gPrefs) {
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include <wx/event.h> // to declare custom event types
|
||||
|
||||
void InitPreferences();
|
||||
bool CheckWritablePreferences();
|
||||
wxString UnwritablePreferencesErrorMessage();
|
||||
void FinishPreferences();
|
||||
|
||||
class AudacityPrefs;
|
||||
|
||||
Reference in New Issue
Block a user