From cd9290876bafb566eb6a6d8961bd9e833c764eca Mon Sep 17 00:00:00 2001 From: LucDeCaf Date: Wed, 31 Dec 2025 11:58:41 +0200 Subject: [PATCH] Check package root for powersync.dll --- .../PowerSync.Common/Utils/PowerSyncPathResolver.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/PowerSync/PowerSync.Common/Utils/PowerSyncPathResolver.cs b/PowerSync/PowerSync.Common/Utils/PowerSyncPathResolver.cs index be382d8..dd56d69 100644 --- a/PowerSync/PowerSync.Common/Utils/PowerSyncPathResolver.cs +++ b/PowerSync/PowerSync.Common/Utils/PowerSyncPathResolver.cs @@ -13,11 +13,18 @@ public static string GetNativeLibraryPath(string packagePath) return Path.Combine(AppContext.BaseDirectory, "powersync.dll"); } + string fileName = GetFileNameForPlatform(); + + // Packaged MSIX/Appx applications flatten all DLLs into one folder + string flattenedPath = Path.Combine(packagePath, fileName); + if (File.Exists(flattenedPath)) + { + return flattenedPath; + } + string rid = GetRuntimeIdentifier(); string nativeDir = Path.Combine(packagePath, "runtimes", rid, "native"); - string fileName = GetFileNameForPlatform(); - return Path.Combine(nativeDir, fileName); } @@ -63,4 +70,4 @@ private static string GetFileNameForPlatform() throw new PlatformNotSupportedException("Unsupported platform."); } } -} \ No newline at end of file +}