Skip to content

Commit 1d81fdc

Browse files
authored
Merge pull request #28 from powersync-ja/fix/load-ext-in-packaged-apps
2 parents 756967f + b5547d0 commit 1d81fdc

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

PowerSync/PowerSync.Common/Utils/PowerSyncPathResolver.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,17 @@ public static class PowerSyncPathResolver
66
{
77
public static string GetNativeLibraryPath(string packagePath)
88
{
9+
string fileName = GetFileNameForPlatform();
910

10-
// .NET Framework 4.8 on Windows requires a different path (not supporting versions prior to this)
11-
if (RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework 4.8") && RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
12-
{
13-
return Path.Combine(AppContext.BaseDirectory, "powersync.dll");
14-
}
11+
// Check the flattened path first since some technologies (eg. .NET Framework 4.8) flatten libraries into the root folder.
12+
// Checking this path first also makes debugging easier, since one can easily change the resolved DLL.
13+
string flattenedPath = Path.Combine(packagePath, fileName);
14+
if (File.Exists(flattenedPath)) return flattenedPath;
1515

16+
// Otherwise, check the native code dir
1617
string rid = GetRuntimeIdentifier();
1718
string nativeDir = Path.Combine(packagePath, "runtimes", rid, "native");
1819

19-
string fileName = GetFileNameForPlatform();
20-
2120
return Path.Combine(nativeDir, fileName);
2221
}
2322

0 commit comments

Comments
 (0)