forked from oxen-io/lokinet-gui
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlokinetProcessManagerMacOS.ts
More file actions
25 lines (21 loc) · 914 Bytes
/
Copy pathlokinetProcessManagerMacOS.ts
File metadata and controls
25 lines (21 loc) · 914 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
import { ILokinetProcessManager, invoke } from './lokinetProcessManager';
import { logLineToAppSide } from './ipcNode';
import { app } from 'electron';
import { dirname } from 'path';
function getLokinetControlLocation() {
// We will be at: Lokinet.app/Contents/Helpers/Lokinet-GUI.app/Contents/MacOS/Lokinet-GUI, we want to back to
// Lokinet.app/Contents/MacOS/Lokinet:
const controlLocation =
dirname(dirname(dirname(dirname(dirname(app.getPath('exe')))))) +
'/MacOS/Lokinet';
logLineToAppSide(`Lokinet bin control location: "${controlLocation}"`);
return controlLocation;
}
export class LokinetMacOSProcessManager implements ILokinetProcessManager {
nodeStartLokinetProcess(): Promise<string | null> {
return invoke(getLokinetControlLocation(), ['--start']);
}
nodeStopLokinetProcess(): Promise<string | null> {
return invoke(getLokinetControlLocation(), ['--stop']);
}
}