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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
|
From c684eba5a4946082ada8bd1349755b24c4ad3b9d Mon Sep 17 00:00:00 2001
From: Gustavo Parreira <gustavotcparreira@gmail.com>
Date: Fri, 25 Nov 2022 19:31:36 +0000
Subject: [PATCH 1/8] fix: linux crash due to GPU process
---
app/main.dev.ts | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/app/main.dev.ts b/app/main.dev.ts
index 31825ef..8e65f5b 100644
--- a/app/main.dev.ts
+++ b/app/main.dev.ts
@@ -16,6 +16,7 @@ import MenuBuilder from './menu';
import axios from 'axios';
import { FileDownloader } from './utils/FileDownloader';
import { IpcCommandHandler, registerIpcCommands } from './ipc-commands';
+import os from 'os';
const { ipcMain: ipc } = require('electron-better-ipc');
const WIN32 = process.platform === 'win32';
@@ -23,6 +24,10 @@ axios.defaults.adapter = require('axios/lib/adapters/http');
const gotTheLock = app.requestSingleInstanceLock();
app.allowRendererProcessReuse = false;
+if (os.platform() === 'linux') {
+ // Avoid GPU not usable error in linux
+ app.commandLine.appendSwitch('in-process-gpu');
+}
let mainWindow: BrowserWindow | null = null;
let ipcHandler = new IpcCommandHandler();
--
2.38.1
From 1e81f91100ffb40b96bfa3690460a7dab66b3db6 Mon Sep 17 00:00:00 2001
From: Gustavo Parreira <gustavotcparreira@gmail.com>
Date: Fri, 25 Nov 2022 19:35:19 +0000
Subject: [PATCH 2/8] fix: normalize paths diffently for DOS and Unix
---
app/steam/DeadByDaylight.ts | 7 ++++++-
app/steam/PlatformSupport.ts | 16 ++++++++++++++++
app/steam/Steam.ts | 5 +++--
3 files changed, 25 insertions(+), 3 deletions(-)
create mode 100644 app/steam/PlatformSupport.ts
diff --git a/app/steam/DeadByDaylight.ts b/app/steam/DeadByDaylight.ts
index 982bdc5..d20586f 100644
--- a/app/steam/DeadByDaylight.ts
+++ b/app/steam/DeadByDaylight.ts
@@ -2,6 +2,7 @@ import SteamApp from './SteamApp';
import fs from 'fs-extra';
import logger from 'electron-log';
import path from 'path';
+import PlatformSupport from './PlatformSupport';
const DEFAULT_DBD_DIRS = ['C:\\Program Files (x86)\\Steam\\steamapps\\common\\Dead by Daylight', 'C:\\Program Files\\Steam\\steamapps\\common\\Dead by Daylight']
@@ -62,6 +63,10 @@ export default class DeadByDaylight {
logger.info('DBD installation found in registry: ' + dbdPath);
}
- return dbdPath?.toLowerCase();
+ if (dbdPath) {
+ return PlatformSupport.normalizePath(dbdPath);
+ }
+
+ return null;
}
}
diff --git a/app/steam/PlatformSupport.ts b/app/steam/PlatformSupport.ts
new file mode 100644
index 0000000..2eea9b2
--- /dev/null
+++ b/app/steam/PlatformSupport.ts
@@ -0,0 +1,16 @@
+import os from 'os';
+
+export default class PlatformSupport {
+ /**
+ * While Windows and DOS systems use case-insensitive file systems, Unix systems like Linux are case-sensitive.
+ * This function will normalize folder paths so they're only lowercased on Windows systems.
+ */
+ static normalizePath(path: string) {
+ switch (os.platform()) {
+ case 'win32':
+ return path.toLowerCase();
+ default:
+ return path;
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/steam/Steam.ts b/app/steam/Steam.ts
index fa92cb1..f0d979e 100644
--- a/app/steam/Steam.ts
+++ b/app/steam/Steam.ts
@@ -3,6 +3,7 @@ import Registry from 'winreg';
import fs from 'fs';
import vdf from 'node-vdf';
import path from 'path';
+import PlatformSupport from './PlatformSupport';
const readFileAsync = promisify(fs.readFile);
@@ -24,8 +25,8 @@ class Steam {
Object.keys(manifest[libFolderKey]).forEach(folder => {
if (isNumeric(folder)) {
const steamPath = path.resolve(manifest[libFolderKey][folder].path ?? manifest[libFolderKey][folder]);
- if(steamPath && !folders.includes(steamPath.toLowerCase())) {
- folders.push(steamPath.toLowerCase());
+ if(steamPath && !folders.includes(PlatformSupport.normalizePath(steamPath))) {
+ folders.push(PlatformSupport.normalizePath(steamPath));
}
}
});
--
2.38.1
From f40bad72eb842faabdfd4fbfcea79164a015f833 Mon Sep 17 00:00:00 2001
From: Gustavo Parreira <gustavotcparreira@gmail.com>
Date: Fri, 25 Nov 2022 19:36:36 +0000
Subject: [PATCH 3/8] feat: finding install path for Steam in Linux
---
app/steam/Steam.ts | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/app/steam/Steam.ts b/app/steam/Steam.ts
index f0d979e..d5a3296 100644
--- a/app/steam/Steam.ts
+++ b/app/steam/Steam.ts
@@ -3,6 +3,8 @@ import Registry from 'winreg';
import fs from 'fs';
import vdf from 'node-vdf';
import path from 'path';
+import { remote } from 'electron';
+import os from 'os';
import PlatformSupport from './PlatformSupport';
const readFileAsync = promisify(fs.readFile);
@@ -36,6 +38,10 @@ class Steam {
}
static async getInstallPath() {
+ if (os.platform() === 'linux') {
+ return Steam._getInstallPathLinux();
+ }
+
let regKey = new Registry({
hive: Registry.HKCU,
key: '\\Software\\Valve\\Steam\\'
@@ -57,6 +63,12 @@ class Steam {
return keyValue.value;
}
}
+
+ static _getInstallPathLinux() {
+ // TODO: Support Flatpak
+ const homeFolder = remote.app.getPath('home');
+ return `${homeFolder}/.steam/steam`;
+ }
}
export default Steam;
--
2.38.1
From 2c50bf03bcb110e8e477c8e68dde7ea69ebbb65a Mon Sep 17 00:00:00 2001
From: Gustavo Parreira <gustavotcparreira@gmail.com>
Date: Fri, 25 Nov 2022 19:40:28 +0000
Subject: [PATCH 4/8] fix: missing newline
---
app/steam/PlatformSupport.ts | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/steam/PlatformSupport.ts b/app/steam/PlatformSupport.ts
index 2eea9b2..feef849 100644
--- a/app/steam/PlatformSupport.ts
+++ b/app/steam/PlatformSupport.ts
@@ -2,7 +2,8 @@ import os from 'os';
export default class PlatformSupport {
/**
- * While Windows and DOS systems use case-insensitive file systems, Unix systems like Linux are case-sensitive.
+ * While Windows and DOS systems use case-insensitive file systems,
+ * Unix systems like Linux are case-sensitive.
* This function will normalize folder paths so they're only lowercased on Windows systems.
*/
static normalizePath(path: string) {
@@ -13,4 +14,4 @@ export default class PlatformSupport {
return path;
}
}
-}
\ No newline at end of file
+}
--
2.38.1
From d1ad50316d692803a89b07596ab7cd476bdc3cff Mon Sep 17 00:00:00 2001
From: Gustavo Parreira <gustavotcparreira@gmail.com>
Date: Fri, 25 Nov 2022 20:05:41 +0000
Subject: [PATCH 5/8] refactor: changed platform check for consistency
---
app/main.dev.ts | 4 ++--
app/steam/PlatformSupport.ts | 4 +---
app/steam/Steam.ts | 2 +-
3 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/app/main.dev.ts b/app/main.dev.ts
index 8e65f5b..9be77db 100644
--- a/app/main.dev.ts
+++ b/app/main.dev.ts
@@ -16,15 +16,15 @@ import MenuBuilder from './menu';
import axios from 'axios';
import { FileDownloader } from './utils/FileDownloader';
import { IpcCommandHandler, registerIpcCommands } from './ipc-commands';
-import os from 'os';
const { ipcMain: ipc } = require('electron-better-ipc');
const WIN32 = process.platform === 'win32';
+const LINUX = process.platform === 'linux';
axios.defaults.adapter = require('axios/lib/adapters/http');
const gotTheLock = app.requestSingleInstanceLock();
app.allowRendererProcessReuse = false;
-if (os.platform() === 'linux') {
+if (LINUX) {
// Avoid GPU not usable error in linux
app.commandLine.appendSwitch('in-process-gpu');
}
diff --git a/app/steam/PlatformSupport.ts b/app/steam/PlatformSupport.ts
index feef849..529e18e 100644
--- a/app/steam/PlatformSupport.ts
+++ b/app/steam/PlatformSupport.ts
@@ -1,5 +1,3 @@
-import os from 'os';
-
export default class PlatformSupport {
/**
* While Windows and DOS systems use case-insensitive file systems,
@@ -7,7 +5,7 @@ export default class PlatformSupport {
* This function will normalize folder paths so they're only lowercased on Windows systems.
*/
static normalizePath(path: string) {
- switch (os.platform()) {
+ switch (process.platform) {
case 'win32':
return path.toLowerCase();
default:
diff --git a/app/steam/Steam.ts b/app/steam/Steam.ts
index d5a3296..91864bf 100644
--- a/app/steam/Steam.ts
+++ b/app/steam/Steam.ts
@@ -38,7 +38,7 @@ class Steam {
}
static async getInstallPath() {
- if (os.platform() === 'linux') {
+ if (process.platform === 'linux') {
return Steam._getInstallPathLinux();
}
--
2.38.1
From ddf6e77bed238ee2af0a8ad04596b968680c8226 Mon Sep 17 00:00:00 2001
From: Gustavo Parreira <gustavotcparreira@gmail.com>
Date: Fri, 25 Nov 2022 20:07:46 +0000
Subject: [PATCH 6/8] fix: removed unused import
---
app/steam/Steam.ts | 1 -
1 file changed, 1 deletion(-)
diff --git a/app/steam/Steam.ts b/app/steam/Steam.ts
index 91864bf..582a9dc 100644
--- a/app/steam/Steam.ts
+++ b/app/steam/Steam.ts
@@ -4,7 +4,6 @@ import fs from 'fs';
import vdf from 'node-vdf';
import path from 'path';
import { remote } from 'electron';
-import os from 'os';
import PlatformSupport from './PlatformSupport';
const readFileAsync = promisify(fs.readFile);
--
2.38.1
From 46896b34734c9805a865a22d7bed4dab130e4c24 Mon Sep 17 00:00:00 2001
From: Gustavo Parreira <gustavotcparreira@gmail.com>
Date: Fri, 25 Nov 2022 20:10:07 +0000
Subject: [PATCH 7/8] refactor: saner path join
---
app/steam/Steam.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/steam/Steam.ts b/app/steam/Steam.ts
index 582a9dc..dac1b61 100644
--- a/app/steam/Steam.ts
+++ b/app/steam/Steam.ts
@@ -66,7 +66,7 @@ class Steam {
static _getInstallPathLinux() {
// TODO: Support Flatpak
const homeFolder = remote.app.getPath('home');
- return `${homeFolder}/.steam/steam`;
+ return path.join(homeFolder, '.steam/steam');
}
}
--
2.38.1
From ed880886b03a89a5c7a304ffae2d4154cb0b088b Mon Sep 17 00:00:00 2001
From: Gustavo Parreira <gustavotcparreira@gmail.com>
Date: Mon, 28 Nov 2022 19:58:39 +0000
Subject: [PATCH 8/8] feat: linux build options
---
package.json | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/package.json b/package.json
index 8787eaf..2ceb223 100644
--- a/package.json
+++ b/package.json
@@ -77,6 +77,16 @@
"msi"
]
},
+ "linux": {
+ "category": "Utility",
+ "icon": "resources",
+ "target": [
+ "AppImage",
+ "deb",
+ "rpm",
+ "tar.gz"
+ ]
+ },
"directories": {
"buildResources": "resources",
"output": "release"
--
2.38.1
|