1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-30 08:26:59 +02:00

Chore: Desktop: Remove duplicate buildDir-finding logic (#9811)

This commit is contained in:
Henry Heino 2024-02-02 10:34:38 -08:00 committed by GitHub
parent bc8392ad52
commit b51e16c255
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1,19 +1,11 @@
import { join, resolve, basename, dirname } from 'path';
import { join, resolve } from 'path';
import bridge from '../../services/bridge';
const pathToBundled7Zip = () => {
// 7zip-bin is very large -- return the path to a version of 7zip
// copied from 7zip-bin.
const executableName = process.platform === 'win32' ? '7za.exe' : '7za';
let rootDir = dirname(dirname(__dirname));
// When bundled, __dirname points to a file within app.asar. The build/ directory
// is outside of app.asar, and thus, we need an extra dirname(...).
if (basename(rootDir).startsWith('app.asar')) {
rootDir = dirname(rootDir);
}
const baseDir = join(rootDir, 'build', '7zip');
const baseDir = join(bridge().buildDir(), '7zip');
return { baseDir, executableName, fullPath: resolve(join(baseDir, executableName)) };
};