Skip to content

Commit 9ca79e9

Browse files
committed
- Fixed issue where initial config files for new profile were incorrectly written to the active profile folder instead.
- Fixed issue that caused main thread log statements to fail with null/undefined values.
1 parent e9c0df7 commit 9ca79e9

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

src/app/components/profile-settings/profile-settings.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ export class AppProfileSettingsComponent extends BaseComponent {
339339
const gameDetails = this.gameDb[profile.gameId];
340340
return forkJoin(Object.keys(gameDetails.gameConfigFiles!).map((configFile) => {
341341
return this.profileManager.readConfigFile(profile, configFile, true).pipe(
342-
mergeMap(fileData => this.profileManager.updateConfigFile(configFile, fileData))
342+
mergeMap(fileData => this.profileManager.updateConfigFile(profile, configFile, fileData))
343343
);
344344
}));
345345
}),

src/app/pages/mods-overview/mods-overview.page.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export class AppModsOverviewPage extends BasePage {
199199
}
200200

201201
protected updateConfigFile(fileName: string, data: string): Observable<unknown> {
202-
return runOnce(this.profileManager.updateConfigFile(fileName, data).pipe(
202+
return runOnce(this.profileManager.updateConfigFile(this.activeProfile!, fileName, data).pipe(
203203
tap(() => this.configFileUpdate$.next(new Date()))
204204
));
205205
}

src/app/services/profile-manager.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,11 +1047,8 @@ export class ProfileManager {
10471047
return ElectronUtils.invoke("profile:readConfigFile", { profile, fileName, loadDefaults });
10481048
}
10491049

1050-
public updateConfigFile(fileName: string, data: string): Observable<unknown> {
1051-
return runOnce(this.activeProfile$.pipe(
1052-
take(1),
1053-
switchMap(profile => ElectronUtils.invoke("profile:updateConfigFile", { profile: profile!, fileName, data }))
1054-
));
1050+
public updateConfigFile(profile: AppProfile, fileName: string, data: string): Observable<unknown> {
1051+
return runOnce(ElectronUtils.invoke("profile:updateConfigFile", { profile: profile!, fileName, data }));
10551052
}
10561053

10571054
public isArchiveInvalidationEnabled(): Observable<boolean> {

src/electron.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3264,12 +3264,16 @@ class ElectronLoader {
32643264

32653265
/** @return {string} */
32663266
#formatLogArg(arg) {
3267-
if (arg instanceof Error) {
3267+
if (arg === undefined) {
3268+
return "undefined";
3269+
} else if (arg === null) {
3270+
return "null";
3271+
} else if (arg instanceof Error) {
32683272
return arg.toString();
32693273
} else if (typeof arg === "object") {
32703274
return JSON.stringify(arg);
32713275
} else {
3272-
return arg.toString();
3276+
return arg?.toString();
32733277
}
32743278
}
32753279
}

0 commit comments

Comments
 (0)