simplify LuaFileList more

This commit is contained in:
adelikat 2020-05-31 11:18:02 -05:00
parent 4be160a71f
commit 4b696e64fa
1 changed files with 15 additions and 17 deletions

View File

@ -98,28 +98,26 @@ namespace BizHawk.Client.Common
public void SaveSession(string path) public void SaveSession(string path)
{ {
using (var sw = new StreamWriter(path)) using var sw = new StreamWriter(path);
var sb = new StringBuilder();
foreach (var file in this)
{ {
var sb = new StringBuilder(); if (file.IsSeparator)
foreach (var file in this)
{ {
if (file.IsSeparator) sb.AppendLine("---");
{ }
sb.AppendLine("---"); else
} {
else sb
{ .Append(file.Enabled ? "1" : "0")
sb .Append(' ')
.Append(file.Enabled ? "1" : "0") .Append(Global.Config.PathEntries.AbsolutePathFor(file.Path, "").MakeRelativeTo(Path.GetDirectoryName(path)))
.Append(' ') .AppendLine();
.Append(Global.Config.PathEntries.AbsolutePathFor(file.Path, "").MakeRelativeTo(Path.GetDirectoryName(path)))
.AppendLine();
}
} }
sw.Write(sb.ToString());
} }
sw.Write(sb.ToString());
Filename = path; Filename = path;
Global.Config.RecentLuaSession.Add(path); Global.Config.RecentLuaSession.Add(path);
Changes = false; Changes = false;