summaryrefslogtreecommitdiffhomepage
path: root/app/lib/proc.js
diff options
context:
space:
mode:
authorErik Larkö <erik@mullvad.net>2017-11-02 10:51:12 +0100
committerErik Larkö <erik@mullvad.net>2017-11-09 12:42:56 +0100
commitae8e86bb81cc722d9667c439d3508660398da707 (patch)
tree05a467e918755c290194df119d5977862d1e6f4b /app/lib/proc.js
parent01d617bab821f25412f4874354468afea30bd7b9 (diff)
downloadmullvadvpn-ae8e86bb81cc722d9667c439d3508660398da707.tar.xz
mullvadvpn-ae8e86bb81cc722d9667c439d3508660398da707.zip
Problem report
Diffstat (limited to 'app/lib/proc.js')
-rw-r--r--app/lib/proc.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/lib/proc.js b/app/lib/proc.js
new file mode 100644
index 0000000000..d11fa392a5
--- /dev/null
+++ b/app/lib/proc.js
@@ -0,0 +1,27 @@
+// @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_BACKEND || '../talpid_core/target/debug';
+
+ } else {
+ return process.resourcesPath;
+ }
+}
+
+function getExtension() {
+ switch (process.platform) {
+ case 'win32':
+ return '.exe';
+
+ default:
+ return '';
+ }
+}