LuaFileList - remove pathing concerns to the calling code

This commit is contained in:
adelikat 2020-05-31 11:49:41 -05:00
parent 4b696e64fa
commit 99dc0e03df
2 changed files with 8 additions and 4 deletions

View File

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.IO;
using System.Text;
using BizHawk.Common.PathExtensions;
namespace BizHawk.Client.Common
{
@ -111,7 +110,7 @@ namespace BizHawk.Client.Common
sb
.Append(file.Enabled ? "1" : "0")
.Append(' ')
.Append(Global.Config.PathEntries.AbsolutePathFor(file.Path, "").MakeRelativeTo(Path.GetDirectoryName(path)))
.Append(path)
.AppendLine();
}
}
@ -119,7 +118,6 @@ namespace BizHawk.Client.Common
sw.Write(sb.ToString());
Filename = path;
Global.Config.RecentLuaSession.Add(path);
Changes = false;
}
}

View File

@ -657,7 +657,12 @@ namespace BizHawk.Client.EmuHawk
var file = GetSaveFileFromUser();
if (file != null)
{
LuaImp.ScriptList.SaveSession(file.FullName);
var path = Config.PathEntries
.AbsolutePathFor(file.FullName, "")
.MakeRelativeTo(Path.GetDirectoryName(file.FullName));
LuaImp.ScriptList.SaveSession(path);
Config.RecentLuaSession.Add(file.FullName); // TODO: should path be used here?
OutputMessages.Text = $"{Path.GetFileName(LuaImp.ScriptList.Filename)} saved.";
}
}
@ -723,6 +728,7 @@ namespace BizHawk.Client.EmuHawk
if (!string.IsNullOrWhiteSpace(LuaImp.ScriptList.Filename))
{
LuaImp.ScriptList.SaveSession(LuaImp.ScriptList.Filename);
Config.RecentLuaSession.Add(LuaImp.ScriptList.Filename);
}
else
{