-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathpaths.js
More file actions
31 lines (27 loc) · 951 Bytes
/
paths.js
File metadata and controls
31 lines (27 loc) · 951 Bytes
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
const os = require('os');
const path = require('path');
const process = require('process');
// WARNING! THIS FILE MUST BE KEPT IN SYNC WITH `internal/installation/paths_*.go`
const installPath = () => {
switch (process.platform) {
case 'win32':
return path.join(process.env.USERPROFILE, "AppData", "Local", "ActiveState", "StateTool", "release");
case 'darwin':
return path.join(os.homedir(), ".local", "ActiveState", "StateTool", "release");
case 'linux':
return path.join(os.homedir(), ".local", "ActiveState", "StateTool", "release");
default:
throw new Error(`Unsupported platform: ${process.platform}`);
}
};
const binPath = () => {
let ext = "";
if (process.platform === 'win32') {
ext = ".exe";
}
return path.join(installPath(), "bin", "state" + ext);
};
module.exports = {
installPath: installPath,
binPath: binPath,
};