From 43ee529934b6ee41286dfa81ca09deb6cd47ad3a Mon Sep 17 00:00:00 2001 From: DominicGBauer Date: Mon, 20 Jan 2025 10:09:17 +0200 Subject: [PATCH] fix: revert using getDyLibPath --- packages/powersync-op-sqlite/README.md | 3 ++- packages/powersync-op-sqlite/src/db/OPSqliteAdapter.ts | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/powersync-op-sqlite/README.md b/packages/powersync-op-sqlite/README.md index f39a6f26..8695f50a 100644 --- a/packages/powersync-op-sqlite/README.md +++ b/packages/powersync-op-sqlite/README.md @@ -87,7 +87,8 @@ Example usage: ```ts let libPath: string if (Platform.OS === 'ios') { - libPath = getDylibPath('powersync-sqlite-core', 'powersync-sqlite-core') + const bundlePath: string = getBundlePath(); + libPath = `${bundlePath}/Frameworks/powersync-sqlite-core.framework/powersync-sqlite-core`; } else { libPath = 'libpowersync'; } diff --git a/packages/powersync-op-sqlite/src/db/OPSqliteAdapter.ts b/packages/powersync-op-sqlite/src/db/OPSqliteAdapter.ts index be29e6f1..90c56093 100644 --- a/packages/powersync-op-sqlite/src/db/OPSqliteAdapter.ts +++ b/packages/powersync-op-sqlite/src/db/OPSqliteAdapter.ts @@ -15,8 +15,9 @@ import { } from '@op-engineering/op-sqlite'; import Lock from 'async-lock'; import { OPSQLiteConnection } from './OPSQLiteConnection'; -import { Platform } from 'react-native'; +import { NativeModules, Platform } from 'react-native'; import { SqliteOptions } from './SqliteOptions'; +import { getBundlePath } from '..'; /** * Adapter for React Native Quick SQLite @@ -146,9 +147,10 @@ export class OPSQLiteDBAdapter extends BaseObserver implement } } - private loadPowerSyncExtension(DB: DB) { + private async loadPowerSyncExtension(DB: DB) { if (Platform.OS === 'ios') { - const libPath = getDylibPath('powersync-sqlite-core', 'powersync-sqlite-core') + const bundlePath: string = getBundlePath(); + const libPath = `${bundlePath}/Frameworks/powersync-sqlite-core.framework/powersync-sqlite-core`; DB.loadExtension(libPath, 'sqlite3_powersync_init'); } else { DB.loadExtension('libpowersync', 'sqlite3_powersync_init');