Skip to content

Commit 3579b3a

Browse files
committed
Cleanup powersync.dll path resolution logic
1 parent cd92908 commit 3579b3a

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

PowerSync/PowerSync.Common/Utils/PowerSyncPathResolver.cs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,14 @@ public static class PowerSyncPathResolver
66
{
77
public static string GetNativeLibraryPath(string packagePath)
88
{
9-
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-
}
15-
169
string fileName = GetFileNameForPlatform();
1710

18-
// Packaged MSIX/Appx applications flatten all DLLs into one folder
11+
// Check the flattened path first since some technologies (eg. .NET 4.8 Framework) flatten libraries into the root folder.
12+
// Checking this path first also makes debugging easier, since one can easily change the resolved DLL.
1913
string flattenedPath = Path.Combine(packagePath, fileName);
20-
if (File.Exists(flattenedPath))
21-
{
22-
return flattenedPath;
23-
}
14+
if (File.Exists(flattenedPath)) return flattenedPath;
2415

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

0 commit comments

Comments
 (0)