forked from tjanczuk/edge-sql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.js
55 lines (50 loc) · 1.28 KB
/
install.js
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
46
47
48
49
50
51
52
53
54
55
const path = require('path')
const fs = require('fs');
if (process.platform === 'win32'){
if(process.arch === 'x64'){
copy('win-x64', true);
}
else if(process.arch === 'arm64'){
copy('win-arm64', true);
}
else if(process.arch === 'ia32'){
copy('win-x86', true);
}
else{
archError();
}
}
else if(process.platform === 'darwin'){
if(process.arch === 'x64'){
copy('osx-x64');
}
else if(process.arch === 'arm64'){
copy('osx-arm64');
}
else{
archError();
}
}
else if(process.platform === 'linux'){
if(process.arch === 'x64'){
copy('linux-x64');
}
else if(process.arch === 'arm64'){
copy('linux-arm64');
}
else{
archError();
}
}
else{
throw new Error(`Platform '${process.platform}' is not supported. `);
}
function archError(){
throw new Error(`Process architecture '${process.arch}' is not supported on '${process.platform}'`);
}
function copy(source, sni) {
fs.copyFileSync(path.resolve(__dirname, `lib/${source}/System.Data.SqlClient.dll`), path.resolve(__dirname, `lib/System.Data.SqlClient.dll`))
if(sni){
fs.copyFileSync(path.resolve(__dirname, `lib/${source}/sni.dll`), path.resolve(__dirname, `lib/sni.dll`))
}
}