forked from web3ToolBoxDev/toolBoxClient
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
66 lines (63 loc) · 2.56 KB
/
config.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
56
57
58
59
60
61
62
63
64
65
66
const path = require('path');
IS_BUILD = true;
class Config {
static instance = null;
constructor() {
if (!Config.instance) {
Config.instance = this;
this.isBuild = IS_BUILD;
if (process.platform === "win32") {
this.platform = "win32";
this.assetsPath = this.isBuild ? path.resolve(__dirname, '../assets') : path.resolve(__dirname, './assets');
this.defaultExecPath = path.join(this.assetsPath, '/node_for_win/node-v21.6.2-win/node.exe');
this.initWalletScriptPath = path.join(this.assetsPath, '/scripts/initWallet.js');
this.initTwitterScriptPath = path.join(this.assetsPath, '/scripts/initTwitter.js');
this.initDiscordScriptPath = path.join(this.assetsPath, '/scripts/initDiscord.js');
this.openWalletScriptPath = path.join(this.assetsPath, '/scripts/openWallet.js');
} else if (process.platform === "darwin") {
this.platform = "darwin";
this.assetsPath = this.isBuild ? path.resolve(__dirname, '../assets') : path.resolve(__dirname, './assets');
this.defaultExecPath = path.join(this.assetsPath, '/node_for_mac/node-v21.6.2-mac/bin/node');
this.initWalletScriptPath = path.join(this.assetsPath, '/scripts/initWallet.js');
this.initTwitterScriptPath = path.join(this.assetsPath, '/scripts/initTwitter.js');
this.initDiscordScriptPath = path.join(this.assetsPath, '/scripts/initDiscord.js');
this.openWalletScriptPath = path.join(this.assetsPath, '/scripts/openWallet.js');
} else {
console.log("当前平台不是 Windows 也不是 macOS");
}
}
return Config.instance;
}
static getInstance() {
if (!Config.instance) {
console.log('new Config');
Config.instance = new Config();
}
return Config.instance;
}
getIsBuild() {
return this.isBuild;
}
getPlatform() {
return this.platform;
}
getAssetsPath() {
return this.assetsPath;
}
getDefaultExecPath() {
return this.defaultExecPath;
}
getInitWalletScriptPath() {
return this.initWalletScriptPath;
}
getInitTwitterScriptPath() {
return this.initTwitterScriptPath;
}
getInitDiscordScriptPath() {
return this.initDiscordScriptPath;
}
getOpenWalletScriptPath() {
return this.openWalletScriptPath;
}
}
module.exports = Config;