* Fixed an issue with aegisub not trying to open the local config.dat in Windows builds, fixes #902

* Fixed an issue with aegisub failing to start if a local config.dat existed but aegisub did not have permission to write to it

Originally committed to SVN as r3090.
This commit is contained in:
harukalover 2009-06-30 05:55:03 +00:00
parent 2e86a73205
commit b3a69668bf
3 changed files with 17 additions and 4 deletions

View file

@ -146,15 +146,19 @@ bool AegisubApp::OnInit() {
// Set config file
StartupLog(_T("Load configuration"));
Options.LoadDefaults();
#ifndef __WXMSW__
#ifdef __WXMSW__
// TODO: Display a messagebox about permission being needed to write to local config once the string freeze is over with
if (wxFileName::IsFileWritable(StandardPaths::DecodePath(_T("?data/config.dat"))))
Options.SetFile(StandardPaths::DecodePath(_T("?data/config.dat")));
else
Options.SetFile(StandardPaths::DecodePath(_T("?user/config.dat")));
Options.Load();
if (!Options.AsBool(_T("Local config")))
if (!Options.AsBool(_T("Local config")) && Options.GetFile() != StandardPaths::DecodePath(_T("?user/config.dat")))
#endif
{
Options.SetFile(StandardPaths::DecodePath(_T("?user/config.dat")));
Options.Load();
#ifndef __WXMSW__
#ifdef __WXMSW__
wxRemoveFile(StandardPaths::DecodePath(_T("?data/config.dat")));
#endif
}

View file

@ -419,6 +419,14 @@ void OptionsManager::SetFile(wxString file) {
}
////////////////
// Get filename
wxString OptionsManager::GetFile() const
{
return filename;
}
////////
// Save
void OptionsManager::Save() {

View file

@ -79,6 +79,7 @@ public:
void Clear();
void SetFile(wxString file);
wxString GetFile() const;
void Save();
void Load();
void LoadDefaults(bool onlyDefaults=false,bool versionOverride=false);