summaryrefslogtreecommitdiffhomepage
path: root/app/lib/proc.js
blob: 5e7396fa9a0eab4c1cf882ec6620589113cf4dbc (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
26
// @flow

import path from 'path';

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

function getBasePath() {
  if (process.env.NODE_ENV === 'development') {
    return process.env.MULLVAD_PATH || './target/debug';
  } else {
    return process.resourcesPath;
  }
}

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

    default:
      return '';
  }
}