Browse Source

Fix preloader crash in Unity 5 when getting process path

ghorsington 5 years ago
parent
commit
a35ec8d25c
1 changed files with 1 additions and 5 deletions
  1. 1 5
      BepInEx.Preloader/Entrypoint.cs

+ 1 - 5
BepInEx.Preloader/Entrypoint.cs

@@ -56,7 +56,7 @@ namespace BepInEx.Preloader
 			{
 				EnvVars.LoadVars();
 
-				silentExceptionLog = Path.Combine(GetCurrentProcessDirectory(), silentExceptionLog);
+				silentExceptionLog = Path.Combine(Path.GetDirectoryName(args[0]), silentExceptionLog);
 
 				// Get the path of this DLL via Doorstop env var because Assembly.Location mangles non-ASCII characters on some versions of Mono for unknown reasons
 				preloaderPath = Path.GetDirectoryName(Path.GetFullPath(EnvVars.DOORSTOP_INVOKE_DLL_PATH));
@@ -91,9 +91,5 @@ namespace BepInEx.Preloader
 			}
 		}
 
-		private static string GetCurrentProcessDirectory()
-		{
-			return Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);
-		}
 	}
 }