From 99dc0e03df4c4cd20420507a06dd9987cbdf7140 Mon Sep 17 00:00:00 2001
From: adelikat <adelikat@tasvideos.org>
Date: Sun, 31 May 2020 11:49:41 -0500
Subject: [PATCH] LuaFileList - remove pathing concerns to the calling code

---
 src/BizHawk.Client.Common/lua/LuaFileList.cs       | 4 +---
 src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs | 8 +++++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/BizHawk.Client.Common/lua/LuaFileList.cs b/src/BizHawk.Client.Common/lua/LuaFileList.cs
index bfd0dccf86..daea20c2a0 100644
--- a/src/BizHawk.Client.Common/lua/LuaFileList.cs
+++ b/src/BizHawk.Client.Common/lua/LuaFileList.cs
@@ -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;
 		}
 	}
diff --git a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
index 9270cff640..00c4d1d8a1 100644
--- a/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
+++ b/src/BizHawk.Client.EmuHawk/tools/Lua/LuaConsole.cs
@@ -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
 			{