Skip to content

Commit e66c15b

Browse files
committed
Add process path to mutex name
1 parent 87024c8 commit e66c15b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

BepInEx.IL2CPP/DoorstopEntrypoint.cs

+8-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ public static void PreloaderMain(string[] args)
1717

1818
PlatformUtils.SetPlatform();
1919

20-
Paths.SetExecutablePath(EnvVars.DOORSTOP_PROCESS_PATH, bepinPath, EnvVars.DOORSTOP_MANAGED_FOLDER_DIR, EnvVars.DOORSTOP_DLL_SEARCH_DIRS);
20+
Paths.SetExecutablePath(EnvVars.DOORSTOP_PROCESS_PATH, bepinPath, EnvVars.DOORSTOP_MANAGED_FOLDER_DIR,
21+
EnvVars.DOORSTOP_DLL_SEARCH_DIRS);
2122

2223
// Cecil 0.11 requires one to manually set up list of trusted assemblies for assembly resolving
2324
AppDomain.CurrentDomain.AddCecilPlatformAssemblies(Paths.ManagedPath);
@@ -67,12 +68,9 @@ public static void Main(string[] args)
6768
// We set it to the current directory first as a fallback, but try to use the same location as the .exe file.
6869
var silentExceptionLog = $"preloader_{DateTime.Now:yyyyMMdd_HHmmss_fff}.log";
6970
Mutex mutex = null;
70-
71+
7172
try
7273
{
73-
mutex = new Mutex(false, Process.GetCurrentProcess().ProcessName + typeof(DoorstopEntrypoint).FullName);
74-
mutex.WaitOne();
75-
7674
EnvVars.LoadVars();
7775

7876
silentExceptionLog =
@@ -81,6 +79,11 @@ public static void Main(string[] args)
8179
// 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
8280
preloaderPath = Path.GetDirectoryName(Path.GetFullPath(EnvVars.DOORSTOP_INVOKE_DLL_PATH));
8381

82+
mutex = new Mutex(false,
83+
Process.GetCurrentProcess().ProcessName + EnvVars.DOORSTOP_PROCESS_PATH +
84+
typeof(DoorstopEntrypoint).FullName);
85+
mutex.WaitOne();
86+
8487
AppDomain.CurrentDomain.AssemblyResolve += ResolveCurrentDirectory;
8588

8689
UnityPreloaderRunner.PreloaderMain(args);

0 commit comments

Comments
 (0)