summarylogtreecommitdiffstats
path: root/use-system-7za-and-disable-updater.patch
blob: a07637c91352f5b6c8cf279c1377ebd4c94c7dbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
diff --git i/src/app/desktop/utils/index.js w/src/app/desktop/utils/index.js
index 343d5ad8..45d5a927 100644
--- i/src/app/desktop/utils/index.js
+++ w/src/app/desktop/utils/index.js
@@ -5,7 +5,6 @@ import { extractFull } from 'node-7z';
 import jimp from 'jimp/es';
 import makeDir from 'make-dir';
 import { promisify } from 'util';
-import { ipcRenderer } from 'electron';
 import path from 'path';
 import crypto from 'crypto';
 import { exec, spawn } from 'child_process';
@@ -301,14 +300,7 @@ export const isLatestJavaDownloaded = async (meta, userData, retry) => {
   return isValid;
 };
 
-export const get7zPath = async () => {
-  // Get userData from ipc because we can't always get this from redux
-  const baseDir = await ipcRenderer.invoke('getUserData');
-  if (process.platform === 'darwin' || process.platform === 'linux') {
-    return path.join(baseDir, '7za');
-  }
-  return path.join(baseDir, '7za.exe');
-};
+export const get7zPath = async () => '/usr/bin/7za';
 
 export const extractNatives = async (libraries, instancePath) => {
   const extractLocation = path.join(instancePath, 'natives');
diff --git i/public/electron.js w/public/electron.js
index 800a66f8..58bfb998 100644
--- i/public/electron.js
+++ w/public/electron.js
@@ -12,7 +12,6 @@ const {
 } = require('electron');
 const path = require('path');
 const { spawn, exec } = require('child_process');
-const { autoUpdater } = require('electron-updater');
 const log = require('electron-log');
 const fss = require('fs');
 const { promisify } = require('util');
@@ -179,43 +178,6 @@ log.log(process.env.REACT_APP_RELEASE_TYPE, app.getVersion());
 
 const isDev = process.env.NODE_ENV === 'development';
 
-async function extract7z() {
-  const baseDir = path.join(app.getAppPath(), 'node_modules', '7zip-bin');
-
-  let zipLocationAsar = path.join(baseDir, 'linux', 'x64', '7za');
-  if (process.platform === 'darwin') {
-    zipLocationAsar = path.join(baseDir, 'mac', 'x64', '7za');
-  }
-  if (process.platform === 'win32') {
-    zipLocationAsar = path.join(baseDir, 'win', 'x64', '7za.exe');
-  }
-  try {
-    await fs.copyFile(
-      zipLocationAsar,
-      path.join(app.getPath('userData'), path.basename(zipLocationAsar))
-    );
-
-    if (process.platform === 'linux' || process.platform === 'darwin') {
-      await promisify(exec)(
-        `chmod +x "${path.join(
-          app.getPath('userData'),
-          path.basename(zipLocationAsar)
-        )}"`
-      );
-      await promisify(exec)(
-        `chmod 755 "${path.join(
-          app.getPath('userData'),
-          path.basename(zipLocationAsar)
-        )}"`
-      );
-    }
-  } catch (e) {
-    log.error(e);
-  }
-}
-
-extract7z();
-
 function createWindow() {
   mainWindow = new BrowserWindow({
     width: 1100,
@@ -609,79 +571,3 @@ ipcMain.handle('calculateMurmur2FromPath', (e, filePath) => {
     });
   });
 });
-
-// AutoUpdater
-
-if (process.env.REACT_APP_RELEASE_TYPE === 'setup') {
-  autoUpdater.autoDownload = false;
-  autoUpdater.allowDowngrade =
-    !allowUnstableReleases && app.getVersion().includes('beta');
-  autoUpdater.allowPrerelease = allowUnstableReleases;
-  autoUpdater.setFeedURL({
-    owner: 'gorilla-devs',
-    repo: 'GDLauncher',
-    provider: 'github'
-  });
-
-  autoUpdater.on('update-available', () => {
-    autoUpdater.downloadUpdate();
-  });
-
-  autoUpdater.on('update-downloaded', () => {
-    mainWindow.webContents.send('updateAvailable');
-  });
-
-  ipcMain.handle('checkForUpdates', () => {
-    autoUpdater.checkForUpdates();
-  });
-}
-
-ipcMain.handle('installUpdateAndQuitOrRestart', async (e, quitAfterInstall) => {
-  const tempFolder = path.join(
-    path.dirname(app.getPath('exe')),
-    'data',
-    'temp'
-  );
-  if (process.env.REACT_APP_RELEASE_TYPE === 'setup') {
-    autoUpdater.quitAndInstall(true, !quitAfterInstall);
-  } else {
-    const updaterVbs = 'updater.vbs';
-    const updaterBat = 'updateLauncher.bat';
-    await fs.writeFile(
-      path.join(tempFolder, updaterBat),
-      `ping 127.0.0.1 -n 1 > nul & robocopy "${path.join(
-        tempFolder,
-        'update'
-      )}" "." /MOV /E${
-        quitAfterInstall ? '' : ` & start "" "${app.getPath('exe')}"`
-      }
-        DEL "${path.join(tempFolder, updaterVbs)}"
-        DEL "%~f0"
-        `
-    );
-
-    await fs.writeFile(
-      path.join(tempFolder, updaterVbs),
-      `Set WshShell = CreateObject("WScript.Shell") 
-          WshShell.Run chr(34) & "${path.join(
-            tempFolder,
-            updaterBat
-          )}" & Chr(34), 0
-          Set WshShell = Nothing
-          `
-    );
-
-    const updateSpawn = spawn(path.join(tempFolder, updaterVbs), {
-      cwd: path.dirname(app.getPath('exe')),
-      detached: true,
-      shell: true,
-      stdio: [
-        'ignore' /* stdin */,
-        'ignore' /* stdout */,
-        'ignore' /* stderr */
-      ]
-    });
-    updateSpawn.unref();
-    mainWindow.close();
-  }
-});