From 2b5529b6be6854642f01e9bd197ce210c6611199 Mon Sep 17 00:00:00 2001 From: unalone Date: Tue, 18 Feb 2025 00:05:52 +0800 Subject: [PATCH] Fix: Under MAUI for macOS, NativeMethods incorrectly assume the runing system is Windows, but it's MacCatalyst. --- .../Internal/PInvoke/NativeMethods/NativeMethods.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods.cs b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods.cs index aa4074188..934286c2d 100644 --- a/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods.cs +++ b/src/OpenCvSharp/Internal/PInvoke/NativeMethods/NativeMethods.cs @@ -185,9 +185,10 @@ public static bool IsUnix() p == PlatformID.MacOSX || (int)p == 128); #elif NETCOREAPP3_1_OR_GREATER - return RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || - RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || - RuntimeInformation.IsOSPlatform(OSPlatform.FreeBSD); + return OperatingSystem.IsMacCatalyst() || + OperatingSystem.IsFreeBSD() || + OperatingSystem.IsLinux() || + OperatingSystem.IsMacOS(); #else return RuntimeInformation.IsOSPlatform(OSPlatform.Linux) || RuntimeInformation.IsOSPlatform(OSPlatform.OSX);