mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Show error dialog on failure to load settings file
This commit is contained in:
parent
8a07189594
commit
3291ed6966
1 changed files with 41 additions and 2 deletions
|
@ -1187,6 +1187,7 @@ namespace IDE
|
||||||
RedirectToImmediate,
|
RedirectToImmediate,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool mSettingsValid;
|
||||||
public bool mLoadedSettings;
|
public bool mLoadedSettings;
|
||||||
public String mSettingFileText ~ delete _;
|
public String mSettingFileText ~ delete _;
|
||||||
public DateTime mSettingFileDateTime;
|
public DateTime mSettingFileDateTime;
|
||||||
|
@ -1243,6 +1244,9 @@ namespace IDE
|
||||||
|
|
||||||
public void Save()
|
public void Save()
|
||||||
{
|
{
|
||||||
|
if (!mSettingsValid)
|
||||||
|
return;
|
||||||
|
|
||||||
String path = scope .();
|
String path = scope .();
|
||||||
GetSettingsPath(path);
|
GetSettingsPath(path);
|
||||||
|
|
||||||
|
@ -1331,12 +1335,47 @@ namespace IDE
|
||||||
|
|
||||||
public void Load()
|
public void Load()
|
||||||
{
|
{
|
||||||
|
mSettingsValid = true;
|
||||||
|
|
||||||
String path = scope .();
|
String path = scope .();
|
||||||
GetSettingsPath(path);
|
GetSettingsPath(path);
|
||||||
|
IDEUtils.FixFilePath(path);
|
||||||
|
|
||||||
let sd = scope StructuredData();
|
if (!File.Exists(path))
|
||||||
if (sd.Load(path) case .Err)
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
StructuredData sd = null;
|
||||||
|
LoadLoop: while (true)
|
||||||
|
{
|
||||||
|
sd = scope:: StructuredData();
|
||||||
|
if (sd.Load(path) case .Err(let err))
|
||||||
|
{
|
||||||
|
int result = 0;
|
||||||
|
#if !CLI && BF_PLATFORM_WINDOWS
|
||||||
|
result = Windows.MessageBoxA(default, scope $"Failed to load settings file '{path}' with error '{err}'", "BEEF IDE SETTINGS FAILED",
|
||||||
|
Windows.MB_ICONHAND | (.)2);
|
||||||
|
#endif
|
||||||
|
if (result == 3) // Abort
|
||||||
|
{
|
||||||
|
mSettingsValid = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (result == 4) // Retry
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else // Ignore
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (File.GetLastWriteTime(path) case .Ok(let dt))
|
if (File.GetLastWriteTime(path) case .Ok(let dt))
|
||||||
mSettingFileDateTime = dt;
|
mSettingFileDateTime = dt;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue