diff options
Diffstat (limited to 'use-system-7za-and-disable-updater.patch')
-rw-r--r-- | use-system-7za-and-disable-updater.patch | 109 |
1 files changed, 36 insertions, 73 deletions
diff --git a/use-system-7za-and-disable-updater.patch b/use-system-7za-and-disable-updater.patch index c6d5effd7782..edb76d175531 100644 --- a/use-system-7za-and-disable-updater.patch +++ b/use-system-7za-and-disable-updater.patch @@ -2,7 +2,7 @@ diff --git i/src/app/desktop/utils/index.js w/src/app/desktop/utils/index.js index 57399c69..3447920f 100644 --- i/src/app/desktop/utils/index.js +++ w/src/app/desktop/utils/index.js -@@ -5,7 +5,6 @@ import { extractFull } from 'node-7z'; +@@ -5,7 +5,6 @@ import jimp from 'jimp/es'; import makeDir from 'make-dir'; import { promisify } from 'util'; @@ -10,11 +10,10 @@ index 57399c69..3447920f 100644 import path from 'path'; import crypto from 'crypto'; import { exec, spawn } from 'child_process'; -@@ -313,34 +312,13 @@ export const isLatestJavaDownloaded = async ( - return { isValid, log: log?.stderr }; +@@ -314,25 +313,7 @@ }; --export const get7zPath = async () => { + export const get7zPath = async () => { - // Get userData from ipc because we can't always get this from redux - let baseDir = await ipcRenderer.invoke('getExecutablePath'); - if (process.env.NODE_ENV === 'development') { @@ -24,70 +23,20 @@ index 57399c69..3447920f 100644 - } else if (process.platform === 'linux') { - baseDir = path.join(baseDir, '7zip-bin/linux/x64'); - } else if (process.platform === 'darwin') { -- baseDir = path.join(baseDir, '7zip-bin/mac/x64'); +- baseDir = path.resolve(baseDir, '../../../', '7zip-bin/mac/x64'); - } - } -- if (process.platform === 'darwin' || process.platform === 'linux') { +- if (process.platform === 'linux') { - return path.join(baseDir, '7za'); - } +- if (process.platform === 'darwin') { +- return path.resolve(baseDir, '../', '7za'); +- } - return path.join(baseDir, '7za.exe'); --}; -- --get7zPath(); -- - export const extractAll = async ( - source, - destination, - args = {}, - funcs = {} - ) => { -- const sevenZipPath = await get7zPath(); -+ const sevenZipPath = '/usr/bin/7za'; - const extraction = extractFull(source, destination, { - ...args, - yes: true, -diff --git i/src/common/reducers/actions.js w/src/common/reducers/actions.js -index 040414d8..8ec014e4 100644 ---- i/src/common/reducers/actions.js -+++ w/src/common/reducers/actions.js -@@ -83,7 +83,6 @@ import { - } from '../utils/selectors'; - import { - librariesMapper, -- get7zPath, - extractNatives, - getJVMArguments112, - copyAssetsToResources, -@@ -1193,7 +1192,7 @@ export function downloadForge(instanceName) { - `${loader?.mcVersion}.json` - ); - -- const sevenZipPath = await get7zPath(); -+ const sevenZipPath = '/usr/bin/7za'; - const pre152 = lte(coerce(loader?.mcVersion), coerce('1.5.2')); - const pre132 = lte(coerce(loader?.mcVersion), coerce('1.3.2')); - const baseUrl = 'https://maven.minecraftforge.net/net/minecraftforge/forge'; -diff --git i/src/common/modals/InstanceExport/CurseForge/ThirdStep.js w/src/common/modals/InstanceExport/CurseForge/ThirdStep.js -index fef48aab..553c6c84 100644 ---- i/src/common/modals/InstanceExport/CurseForge/ThirdStep.js -+++ w/src/common/modals/InstanceExport/CurseForge/ThirdStep.js -@@ -10,7 +10,6 @@ import makeDir from 'make-dir'; - import { Transition } from 'react-transition-group'; - import styled from 'styled-components'; - import pMap from 'p-map'; --import { get7zPath } from '../../../../app/desktop/utils'; - import { FABRIC, VANILLA, FORGE } from '../../../utils/constants'; - import { getAddon } from '../../../api'; ++ return '/usr/bin/7za'; + }; -@@ -21,7 +20,7 @@ import { getAddon } from '../../../api'; - * @param {Array} filesArray Array of files to include. Relative to current working directory unless full path is passed for each file. - */ - const createZip = async (archiveName, zipDestPath, filesArray) => { -- const sevenZipPath = await get7zPath(); -+ const sevenZipPath = '/usr/bin/7za'; - const zipCreation = add7z( - path.join(zipDestPath, `${archiveName}.zip`), - filesArray, + get7zPath(); diff --git i/public/electron.js w/public/electron.js index d9d436fd..45801af6 100644 --- i/public/electron.js @@ -100,21 +49,35 @@ index d9d436fd..45801af6 100644 const log = require('electron-log'); const fss = require('fs'); const { promisify } = require('util'); -@@ -199,27 +198,6 @@ if ( - +@@ -199,40 +199,9 @@ log.log(process.env.REACT_APP_RELEASE_TYPE, app.getVersion()); --async function patchSevenZip() { -- let sevenZipPath = null; -- const baseDir = path.dirname(app.getPath('exe')); -- if (process.platform === 'darwin' || process.platform === 'linux') { -- sevenZipPath = path.join(baseDir, '7za'); -- } else { -- sevenZipPath = path.join(baseDir, '7za.exe'); + const get7zPath = async () => { +- let baseDir = path.dirname(app.getPath('exe')); +- if (process.env.NODE_ENV === 'development') { +- baseDir = path.resolve(baseDir, '../../'); +- if (process.platform === 'win32') { +- baseDir = path.join(baseDir, '7zip-bin/win/x64'); +- } else if (process.platform === 'linux') { +- baseDir = path.join(baseDir, '7zip-bin/linux/x64'); +- } else if (process.platform === 'darwin') { +- baseDir = path.resolve(baseDir, '../../../', '7zip-bin/mac/x64'); +- } - } -- +- if (process.platform === 'linux') { +- return path.join(baseDir, '7za'); +- } +- if (process.platform === 'darwin') { +- return path.resolve(baseDir, '../', '7za'); +- } +- return path.join(baseDir, '7za.exe'); ++ return '/usr/bin/7za'; + }; + +-async function patchSevenZip() { - try { - if (process.platform === 'linux' || process.platform === 'darwin') { +- const sevenZipPath = await get7zPath(); - await promisify(exec)(`chmod +x "${sevenZipPath}"`); - await promisify(exec)(`chmod 755 "${sevenZipPath}"`); - } @@ -123,7 +86,7 @@ index d9d436fd..45801af6 100644 - } -} - --if (!isDev) patchSevenZip(); +-patchSevenZip(); - function createWindow() { mainWindow = new BrowserWindow({ |