mirror of
https://github.com/keeweb/keeweb.git
synced 2024-06-25 07:37:46 +02:00
loading native modules from updated desktop archives
This commit is contained in:
parent
21768b1b59
commit
360194c627
|
@ -731,10 +731,22 @@ function reportStartProfile() {
|
||||||
|
|
||||||
function reqNative(mod) {
|
function reqNative(mod) {
|
||||||
const fileName = `${mod}-${process.platform}-${process.arch}.node`;
|
const fileName = `${mod}-${process.platform}-${process.arch}.node`;
|
||||||
const binding = require(`@keeweb/keeweb-native-modules/${fileName}`);
|
|
||||||
|
const mainAsarPath = process.mainModule.path;
|
||||||
|
const latestAsarPath = __dirname;
|
||||||
|
const pathInsideAsar = `node_modules/@keeweb/keeweb-native-modules/${fileName}`;
|
||||||
|
|
||||||
|
let fullPath = path.join(latestAsarPath, pathInsideAsar);
|
||||||
|
if (!fs.existsSync(fullPath)) {
|
||||||
|
fullPath = path.join(mainAsarPath, pathInsideAsar);
|
||||||
|
}
|
||||||
|
|
||||||
|
const binding = require(fullPath);
|
||||||
|
|
||||||
if (mod === 'usb') {
|
if (mod === 'usb') {
|
||||||
usbBinding = initUsb(binding);
|
usbBinding = initUsb(binding);
|
||||||
}
|
}
|
||||||
|
|
||||||
return binding;
|
return binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user