Put ClientDllMap.cs behind #if fully

This commit is contained in:
PJB3005
2025-08-17 16:39:21 +02:00
parent 20706870da
commit 697af6771c

View File

@@ -1,4 +1,5 @@
using System;
#if !WINDOWS
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using SDL3;
@@ -10,28 +11,22 @@ namespace Robust.Client.Utility
[ModuleInitializer]
internal static void Initialize()
{
if (OperatingSystem.IsWindows())
return;
NativeLibrary.SetDllImportResolver(typeof(ClientDllMap).Assembly, (name, assembly, path) =>
{
if (name == "swnfd.dll")
{
if (OperatingSystem.IsLinux())
return NativeLibrary.Load("libswnfd.so", assembly, path);
if (OperatingSystem.IsMacOS())
return NativeLibrary.Load("libswnfd.dylib", assembly, path);
return IntPtr.Zero;
#if LINUX || FREEBSD
return NativeLibrary.Load("libswnfd.so", assembly, path);
#elif MACOS
return NativeLibrary.Load("libswnfd.dylib", assembly, path);
#endif
}
if (name == "libEGL.dll")
{
if (OperatingSystem.IsLinux())
return NativeLibrary.Load("libEGL.so", assembly, path);
return IntPtr.Zero;
#if LINUX || FREEBSD
return NativeLibrary.Load("libEGL.so", assembly, path);
#endif
}
if (name == SDL.nativeLibName)
@@ -48,3 +43,4 @@ namespace Robust.Client.Utility
}
}
}
#endif