mirror of
https://github.com/BepInEx/BepInEx.git
synced 2026-10-19 15:51:45 +00:00
Fix GameDataPath exception in non-Unity3D games (#1416)
When `GameDataPath` is invalid, do not throw an exception; instead, set both `GameDataPath` and `ManagedPath` to `null`.
This commit is contained in:
1 parent
5b766a3b7f
commit
6cea286d20
1 file changed
+3
-3
@@ -127,9 +127,9 @@ public static class Paths
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(GameDataPath) || !Directory.Exists(GameDataPath))
|
||||
throw new DirectoryNotFoundException("Failed to extract valid GameDataPath from executablePath: " + executablePath);
|
||||
GameDataPath = null;
|
||||
|
||||
ManagedPath = managedPath ?? Path.Combine(GameDataPath, "Managed");
|
||||
ManagedPath = managedPath ?? (GameDataPath != null ? Path.Combine(GameDataPath, "Managed") : null);
|
||||
BepInExRootPath = bepinRootPath ?? Path.Combine(GameRootPath, "BepInEx");
|
||||
ConfigPath = Path.Combine(BepInExRootPath, "config");
|
||||
BepInExConfigPath = Path.Combine(ConfigPath, "BepInEx.cfg");
|
||||
@@ -139,7 +139,7 @@ public static class Paths
|
||||
BepInExAssemblyPath = Path.Combine(BepInExAssemblyDirectory,
|
||||
$"{Assembly.GetExecutingAssembly().GetName().Name}.dll");
|
||||
CachePath = Path.Combine(BepInExRootPath, "cache");
|
||||
DllSearchPaths = (dllSearchPath ?? new string[0]).Concat(new[] { ManagedPath }).Distinct().ToArray();
|
||||
DllSearchPaths = (dllSearchPath ?? new string[0]).Concat(new[] { ManagedPath }).Where(p => p != null).Distinct().ToArray();
|
||||
}
|
||||
|
||||
internal static void SetPluginPath(string pluginPath) =>
|
||||
|
||||
Reference in new issue
Block a user