-
Notifications
You must be signed in to change notification settings - Fork 23
/
install.js
32 lines (29 loc) · 929 Bytes
/
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
const fs = require('fs');
const readline = require('readline');
const rl = readline.createInterface(process.stdin, process.stdout);
rl.setPrompt('Dota Path: ');
rl.prompt();
rl.on('line', (dotaPath) => {
const gamePath = `${dotaPath}/game/dota_addons`;
const contentPath = `${dotaPath}/content/dota_addons`;
if (!fs.existsSync(gamePath)) {
console.log(`${gamePath} not found`);
rl.prompt();
return;
}
if (!fs.existsSync(contentPath)) {
console.log(`${contentPath} not found`);
rl.prompt();
return;
}
rl.close();
(async () => {
await fs.promises.rename('./game', gamePath + '/12v12');
await fs.promises.rename('./content', contentPath + '/12v12');
await fs.promises.symlink(gamePath + '/12v12', './game', 'junction');
await fs.promises.symlink(contentPath + '/12v12', './content', 'junction');
})().catch(err => {
console.error(err);
process.exit(1);
});
});