-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.js
31 lines (27 loc) · 1.09 KB
/
setup.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
/* get config.json to setup this program */
const fs = require('fs');
const jsfs = require('jsonfile');
const config = jsfs.readFileSync(__dirname+"/config.json");
/* Define storage path here */
var server_battle_record = "";
/* Build server root */
console.log("[io.render] Current platform of io.render server : "+process.platform);
if(process.platform == "win32"){
// if run on Windows, using current directory as storage
/* Build essential record storage place */
if(!fs.existsSync(__dirname +'/'+ config.server_root)){
fs.mkdirSync(__dirname +'/'+ config.server_root);
}
server_battle_record = __dirname +'/'+ config.server_root +'/'+ config.server_battle_record;
}
else if(process.platform == "linux"){
// if run on Linux, using /tmp
if(!fs.existsSync( '/tmp/'+ config.server_root)){
fs.mkdirSync( '/tmp/'+ config.server_root);
}
server_battle_record = '/tmp' + '/' + config.server_root + '/' + config.server_battle_record;
}
/* Build essential record storage place */
if(!fs.existsSync(server_battle_record)){
fs.mkdirSync(server_battle_record);
}