@acentera/node 0.0.8 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +15 -5
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1,4 +1,7 @@
1
1
  const os = require('os');
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+
2
5
 
3
6
  function loadLibrary() {
4
7
  const arch = os.arch();
@@ -7,22 +10,29 @@ function loadLibrary() {
7
10
  let libName;
8
11
  if (platform === 'darwin') {
9
12
  if (arch === 'x64') {
10
- libName = './acentera.dylib.x86';
13
+ libName = 'acentera.dylib.x86';
11
14
  } else {
12
- libName = './acentera.dylib.arm64';
15
+ libName = 'acentera.dylib.arm64';
13
16
  }
14
17
  } else if (platform === 'linux') {
15
18
  if (arch === 'x64') {
16
- libName = './acentera';
19
+ libName = 'acentera';
17
20
  } else {
18
- libName = './acentera.arm64';
21
+ libName = 'acentera.arm64';
19
22
  }
20
23
  } else {
21
24
  throw new Error('Unsupported platform');
22
25
  }
23
26
 
24
27
  libName += '.node';
25
- return require(libName);
28
+ // The path to the file you want to check
29
+ const filePath = path.join(__dirname, libName);
30
+
31
+ if (fs.existsSync(filePath)) {
32
+ return require(filePath);
33
+ } else {
34
+ return require(libName);
35
+ }
26
36
  }
27
37
 
28
38
  module.exports = loadLibrary();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acentera/node",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "description": "ACenterA library",
5
5
  "main": "acentera.node",
6
6
  "scripts": {},