diff --git a/Prowl.Editor/Build/DesktopBuildPipeline.cs b/Prowl.Editor/Build/DesktopBuildPipeline.cs index b26416561..7787a2735 100644 --- a/Prowl.Editor/Build/DesktopBuildPipeline.cs +++ b/Prowl.Editor/Build/DesktopBuildPipeline.cs @@ -344,15 +344,20 @@ public static void Initialize() ? new[] { ".dylib", "" } : new[] { ".so", ".so.1", "" }; + string[] nameVariants = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? new[] { libraryName } + : new[] { libraryName, "lib" + libraryName }; + foreach (var r in rids) { string nativeSubDir = string.IsNullOrEmpty(r) ? Path.Combine("runtimes", "native") : Path.Combine("runtimes", r, "native"); + foreach (var name in nameVariants) foreach (var ext in exts) { - string fullPath = Path.Combine(baseDir, nativeSubDir, libraryName + ext); + string fullPath = Path.Combine(baseDir, nativeSubDir, name + ext); Log($"[Native] Probing: {fullPath}"); if (File.Exists(fullPath)) @@ -371,9 +376,10 @@ public static void Initialize() } // Fallback to root directory + foreach (var name in nameVariants) foreach (var ext in exts) { - string rootPath = Path.Combine(baseDir, libraryName + ext); + string rootPath = Path.Combine(baseDir, name + ext); Log($"[Native] Root probe: {rootPath}"); if (File.Exists(rootPath) && NativeLibrary.TryLoad(rootPath, out IntPtr handle)) { @@ -416,15 +422,20 @@ public static IntPtr ResolveNativeLibrary(string libraryName, Assembly assembly, ? new[] { ".dylib", "" } : new[] { ".so", ".so.1", "" }; + string[] nameVariants = RuntimeInformation.IsOSPlatform(OSPlatform.Windows) + ? new[] { libraryName } + : new[] { libraryName, "lib" + libraryName }; + foreach (var r in rids) { string nativeSubDir = string.IsNullOrEmpty(r) ? Path.Combine("runtimes", "native") : Path.Combine("runtimes", r, "native"); + foreach (var name in nameVariants) foreach (var ext in exts) { - string fullPath = Path.Combine(baseDir, nativeSubDir, libraryName + ext); + string fullPath = Path.Combine(baseDir, nativeSubDir, name + ext); Log($"[Native] Probing: {fullPath}"); if (File.Exists(fullPath)) @@ -443,9 +454,10 @@ public static IntPtr ResolveNativeLibrary(string libraryName, Assembly assembly, } // Last chance: root directory + foreach (var name in nameVariants) foreach (var ext in exts) { - string rootPath = Path.Combine(baseDir, libraryName + ext); + string rootPath = Path.Combine(baseDir, name + ext); if (File.Exists(rootPath) && NativeLibrary.TryLoad(rootPath, out IntPtr handle)) { Log($"[Native] SUCCESS from root: {rootPath}");