Files
Desktop/ts/util/appRootDir.main.ts
2026-03-27 10:55:37 -07:00

15 lines
461 B
TypeScript

// 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, '..', '..');
}