summaryrefslogtreecommitdiffhomepage
path: root/app/lib/proc.js
diff options
context:
space:
mode:
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 '';
+ }
+}