diff --git a/Torch/Patches/ScriptCompilerPatch.cs b/Torch/Patches/ScriptCompilerPatch.cs index ffdcae2..de5975f 100644 --- a/Torch/Patches/ScriptCompilerPatch.cs +++ b/Torch/Patches/ScriptCompilerPatch.cs @@ -45,6 +45,12 @@ namespace Torch.Patches private static void WhitelistCtorPrefix(MyScriptCompiler scriptCompiler) { var baseDir = new FileInfo(typeof(Type).Assembly.Location).DirectoryName!; + var binDir = +#if DEBUG + baseDir; +#else + Path.Join(AppContext.BaseDirectory, "torch64"); +#endif scriptCompiler.AddReferencedAssemblies( typeof(Type).Assembly.Location, @@ -57,22 +63,22 @@ namespace Torch.Patches typeof(TypeConverter).Assembly.Location, typeof(System.Diagnostics.TraceSource).Assembly.Location, typeof(System.Security.Policy.Evidence).Assembly.Location, - Path.Combine(baseDir, "System.Xml.ReaderWriter.dll"), - Path.Combine(MyFileSystem.ExePath, "ProtoBuf.Net.dll"), - Path.Combine(MyFileSystem.ExePath, "ProtoBuf.Net.Core.dll"), - Path.Combine(baseDir, "netstandard.dll"), - Path.Combine(baseDir, "System.Runtime.dll"), - Path.Combine(MyFileSystem.ExePath, "Sandbox.Game.dll"), - Path.Combine(MyFileSystem.ExePath, "Sandbox.Common.dll"), - Path.Combine(MyFileSystem.ExePath, "Sandbox.Graphics.dll"), - Path.Combine(MyFileSystem.ExePath, "VRage.dll"), - Path.Combine(MyFileSystem.ExePath, "VRage.Library.dll"), - Path.Combine(MyFileSystem.ExePath, "VRage.Math.dll"), - Path.Combine(MyFileSystem.ExePath, "VRage.Game.dll"), - Path.Combine(MyFileSystem.ExePath, "VRage.Render.dll"), - Path.Combine(MyFileSystem.ExePath, "VRage.Input.dll"), - Path.Combine(MyFileSystem.ExePath, "SpaceEngineers.ObjectBuilders.dll"), - Path.Combine(MyFileSystem.ExePath, "SpaceEngineers.Game.dll")); + Path.Join(binDir, "System.Xml.ReaderWriter.dll"), + Path.Join(MyFileSystem.ExePath, "ProtoBuf.Net.dll"), + Path.Join(MyFileSystem.ExePath, "ProtoBuf.Net.Core.dll"), + Path.Join(binDir, "netstandard.dll"), + Path.Join(baseDir, "System.Runtime.dll"), + Path.Join(MyFileSystem.ExePath, "Sandbox.Game.dll"), + Path.Join(MyFileSystem.ExePath, "Sandbox.Common.dll"), + Path.Join(MyFileSystem.ExePath, "Sandbox.Graphics.dll"), + Path.Join(MyFileSystem.ExePath, "VRage.dll"), + Path.Join(MyFileSystem.ExePath, "VRage.Library.dll"), + Path.Join(MyFileSystem.ExePath, "VRage.Math.dll"), + Path.Join(MyFileSystem.ExePath, "VRage.Game.dll"), + Path.Join(MyFileSystem.ExePath, "VRage.Render.dll"), + Path.Join(MyFileSystem.ExePath, "VRage.Input.dll"), + Path.Join(MyFileSystem.ExePath, "SpaceEngineers.ObjectBuilders.dll"), + Path.Join(MyFileSystem.ExePath, "SpaceEngineers.Game.dll")); } private static bool InitializePrefix(Thread updateThread, Type[] referencedTypes, string[] symbols)