mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-19 07:58:46 +01:00
Remove use of __dirname from main process
This commit is contained in:
14
ts/util/appRootDir.main.ts
Normal file
14
ts/util/appRootDir.main.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// Copyright 2026 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { app } from 'electron';
|
||||
import { join } from 'node:path';
|
||||
|
||||
export function getAppRootDir(): string {
|
||||
// We have this logic because test-node runs under `electron-mocha` that has
|
||||
// `app.getAppPath()` pointing within `electron-mocha`'s folder.
|
||||
if (app.isPackaged || process.env.IS_BUNDLED) {
|
||||
return app.getAppPath();
|
||||
}
|
||||
return join(__dirname, '..', '..');
|
||||
}
|
||||
Reference in New Issue
Block a user