Skip to content

Commit

Permalink
Make loadXapian() accept custom path
Browse files Browse the repository at this point in the history
  • Loading branch information
tadzik committed Nov 6, 2020
1 parent 83a0499 commit 51399a9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "runbox-searchindex",
"version": "0.2.0",
"version": "0.2.1",
"scripts": {
"build": "node compilermmxapianapi.js --xapiandir=xapian/xapian-core && tsc",
"test": "mocha-typescript-watch -p tsconfig.json build/test/test.js",
Expand Down
7 changes: 5 additions & 2 deletions ts/xapian/xapian.loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@ declare var global;

let xapianLoadedSubject: AsyncSubject<boolean>;

export function loadXapian(): AsyncSubject<boolean> {
export function loadXapian(path?: string): AsyncSubject<boolean> {
if(!xapianLoadedSubject) {
xapianLoadedSubject = new AsyncSubject();

const xapian = require(`${process.cwd()}/dist/xapianasm.js`);
if (!path) {
path = `${process.cwd()}/dist/xapianasm.js`
}
const xapian = require(path);

global.termlistresult = [];
global.Module = xapian;
Expand Down

0 comments on commit 51399a9

Please sign in to comment.