mirror of
https://github.com/beefytech/Beef.git
synced 2025-07-06 00:05:59 +02:00
Better setting/project/workspace handling of concurrent IDE instances
This commit is contained in:
parent
fe5cae2220
commit
d3ca45d80a
4 changed files with 130 additions and 1 deletions
|
@ -1091,6 +1091,8 @@ namespace IDE
|
|||
}
|
||||
|
||||
public bool mLoadedSettings;
|
||||
public String mSettingFileText ~ delete _;
|
||||
public DateTime mSettingFileDateTime;
|
||||
|
||||
public UISettings mUISettings = new .() ~ delete _;
|
||||
public EditorSettings mEditorSettings = new .() ~ delete _;
|
||||
|
@ -1177,7 +1179,29 @@ namespace IDE
|
|||
|
||||
String dataStr = scope String();
|
||||
sd.ToTOML(dataStr);
|
||||
gApp.SafeWriteTextFile(path, dataStr);
|
||||
|
||||
if ((mSettingFileText == null) || (mSettingFileText != dataStr))
|
||||
{
|
||||
String.NewOrSet!(mSettingFileText, dataStr);
|
||||
gApp.SafeWriteTextFile(path, dataStr);
|
||||
|
||||
if (File.GetLastWriteTime(path) case .Ok(let dt))
|
||||
mSettingFileDateTime = dt;
|
||||
}
|
||||
}
|
||||
|
||||
public bool WantsReload()
|
||||
{
|
||||
String path = scope .();
|
||||
GetSettingsPath(path);
|
||||
|
||||
if (File.GetLastWriteTime(path) case .Ok(let dt))
|
||||
{
|
||||
if (dt != mSettingFileDateTime)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Load()
|
||||
|
@ -1189,6 +1213,13 @@ namespace IDE
|
|||
if (sd.Load(path) case .Err)
|
||||
return;
|
||||
|
||||
if (File.GetLastWriteTime(path) case .Ok(let dt))
|
||||
mSettingFileDateTime = dt;
|
||||
|
||||
String.NewOrSet!(mSettingFileText, sd.[Friend]mSource);
|
||||
mSettingFileText.Replace("\r\n", "\n");
|
||||
mSettingFileText.Replace('\r', '\n');
|
||||
|
||||
mLoadedSettings = true;
|
||||
using (sd.Open("UI"))
|
||||
mUISettings.Deserialize(sd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue