-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
45 lines (42 loc) · 1.11 KB
/
main.js
File metadata and controls
45 lines (42 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
const os = require('os');
const path = require('path');
const platform = os.platform();
let dir = '';
switch(platform) {
case 'aix': {
throw new Error("IBM AIX platform not supported");
};
case 'android': {
throw new Error("Android platform is not supported");
};
case 'darwin': {
// console.log("Darwin platfrom(MacOS, IOS etc)");
dir = 'macos';
break;
}
case 'freebsd': {
throw new Error("FreeBSD Platform is not supported");
}
case 'linux': {
// console.log("Linux Platform");
dir = 'linux';
break;
}
case 'openbsd': {
throw new Error("OpenBSD Platform is not supported");
}
case 'sunos': {
throw new Error("SunOS platform is not supported");
}
case 'win32': {
// console.log("windows platform");
dir = 'win32';
break;
}
default: {
// console.log("unknown platform")
throw new Error("Unknown platform");
};
}
const nodePath = path.join(__dirname, '/platform/', dir, '/index.node');
module.exports = require(nodePath);