Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions packages/app-desktop/utils/7zip/pathToBundled7Zip.ts
Original file line number Diff line number Diff line change
@@ -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)) };
};
Expand Down
Loading