Skip to content

Commit

Permalink
fix: revert using getDyLibPath
Browse files Browse the repository at this point in the history
  • Loading branch information
DominicGBauer committed Jan 20, 2025
1 parent 4d8f23a commit 43ee529
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/powersync-op-sqlite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
Expand Down
8 changes: 5 additions & 3 deletions packages/powersync-op-sqlite/src/db/OPSqliteAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -146,9 +147,10 @@ export class OPSQLiteDBAdapter extends BaseObserver<DBAdapterListener> 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');
Expand Down

0 comments on commit 43ee529

Please sign in to comment.