* 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:
parent
2e86a73205
commit
b3a69668bf
3 changed files with 17 additions and 4 deletions
|
@ -146,15 +146,19 @@ bool AegisubApp::OnInit() {
|
|||
// Set config file
|
||||
StartupLog(_T("Load configuration"));
|
||||
Options.LoadDefaults();
|
||||
#ifndef __WXMSW__
|
||||
Options.SetFile(StandardPaths::DecodePath(_T("?data/config.dat")));
|
||||
#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
|
||||
}
|
||||
|
|
|
@ -419,6 +419,14 @@ void OptionsManager::SetFile(wxString file) {
|
|||
}
|
||||
|
||||
|
||||
////////////////
|
||||
// Get filename
|
||||
wxString OptionsManager::GetFile() const
|
||||
{
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
||||
////////
|
||||
// Save
|
||||
void OptionsManager::Save() {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue