summaryrefslogtreecommitdiffhomepage
path: root/gui/src/main/proc.ts
blob: 1e8118268dcea97304c39d6db99426c2b36ea34d (plain)
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
import path from 'path';

export function resolveBin(binaryName: string) {
  return path.resolve(getBasePath(), binaryName + getExtension());
}

function getBasePath(): string {
  if (process.env.NODE_ENV === 'development') {
    return (
      process.env.MULLVAD_PATH || path.resolve(path.join(__dirname, '../../../../target/debug'))
    );
  } else {
    return process.resourcesPath;
  }
}

function getExtension() {
  switch (process.platform) {
    case 'win32':
      return '.exe';

    default:
      return '';
  }
}