fix some lua currdir bugs, but its all broken, dont pay any attention to it
This commit is contained in:
parent
74eba9209c
commit
42c0b62261
|
@ -33,7 +33,8 @@ namespace BizHawk.Client.Common
|
|||
//moreover we don't really have a sense of sandboxing individual scripts, they kind of all get run together in the same VM, i think
|
||||
//so let's just try keeping one 'current directory' for all lua. it's an improvement over lua's 'current directory' for the process, interfering with the core emulator's
|
||||
savedEnvironmentCurrDir = Environment.CurrentDirectory;
|
||||
Environment.CurrentDirectory = CurrentDirectory;
|
||||
if(System.IO.Directory.Exists(CurrentDirectory)) //race condition for great justice
|
||||
Environment.CurrentDirectory = CurrentDirectory;
|
||||
|
||||
EnvironmentSandbox.Sandbox(callback);
|
||||
CurrentDirectory = Environment.CurrentDirectory;
|
||||
|
@ -47,9 +48,12 @@ namespace BizHawk.Client.Common
|
|||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(savedEnvironmentCurrDir != null)
|
||||
Environment.CurrentDirectory = savedEnvironmentCurrDir;
|
||||
{
|
||||
if (savedEnvironmentCurrDir != null)
|
||||
{
|
||||
if (System.IO.Directory.Exists(savedEnvironmentCurrDir)) //race condition for great justice
|
||||
Environment.CurrentDirectory = savedEnvironmentCurrDir;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -159,11 +159,11 @@ namespace BizHawk.Client.EmuHawk
|
|||
|
||||
foreach (var file in runningScripts)
|
||||
{
|
||||
string pathToLoad = Path.IsPathRooted(file.Path) ? file.Path : PathManager.MakeProgramRelativePath(file.Path); //JUNIPIER SQUATCHBOX COMPLEX
|
||||
try
|
||||
{
|
||||
LuaSandbox.Sandbox(() =>
|
||||
{
|
||||
string pathToLoad = PathManager.MakeProgramRelativePath(file.Path); //JUNIPIER SQUATCHBOX COMPLEX
|
||||
file.Thread = LuaImp.SpawnCoroutine(pathToLoad);
|
||||
file.State = LuaFile.RunState.Running;
|
||||
}, () =>
|
||||
|
@ -183,6 +183,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void LoadLuaFile(string path)
|
||||
{
|
||||
var processedPath = PathManager.TryMakeRelative(path);
|
||||
string pathToLoad = Path.IsPathRooted(processedPath) ? processedPath : PathManager.MakeProgramRelativePath(processedPath); //JUNIPIER SQUATCHBOX COMPLEX
|
||||
|
||||
if (LuaAlreadyInSession(processedPath) == false)
|
||||
{
|
||||
|
@ -199,7 +200,6 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
LuaSandbox.Sandbox(() =>
|
||||
{
|
||||
string pathToLoad = PathManager.MakeProgramRelativePath(processedPath); //JUNIPIER SQUATCHBOX COMPLEX
|
||||
luaFile.Thread = LuaImp.SpawnCoroutine(pathToLoad);
|
||||
luaFile.State = LuaFile.RunState.Running;
|
||||
}, () =>
|
||||
|
|
Loading…
Reference in New Issue