Skip to content

Commit

Permalink
auto download custom variables
Browse files Browse the repository at this point in the history
  • Loading branch information
cbartondock committed Apr 30, 2024
1 parent 041a819 commit 8d7a4fa
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 22 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ All notable changes to this project will be documented in this file.
### Changed
* Filter out DMCA'd artwork.
* Split custom variables file ([issue 260](https://github.com/SteamGridDB/steam-rom-manager/issues/260)). Thanks @kencinder.
* Moved filters for preview page into a side panel
* Moved filters for preview page into a side panel.
* Automatically download new custom variables on startup.

## 2.4.24
### Added
Expand Down
43 changes: 22 additions & 21 deletions src/renderer/services/custom-variables.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,28 +76,29 @@ export class CustomVariablesService {
}

load() {
json.read<CustomVariables>(paths.customVariables)
.then((data) => {
if (data === null) {
return this.download();
}
else {
const error = this.set(data || {});
if (error !== null) {
this.savingIsDisabled = true;
this.loggerService.error(this.lang.error.loadingError, { invokeAlert: true, alertTimeout: 5000, doNotAppendToLog: true });
this.loggerService.error(this.lang.error.corruptedVariables__i.interpolate({
file: paths.customVariables,
error
}));
}
return this.download().then(() => {
return json.read<CustomVariables>(paths.customVariables)
}).then((data) => {
if (data === null) {
return this.download();
}
else {
const error = this.set(data || {});
if (error !== null) {
this.savingIsDisabled = true;
this.loggerService.error(this.lang.error.loadingError, { invokeAlert: true, alertTimeout: 5000, doNotAppendToLog: true });
this.loggerService.error(this.lang.error.corruptedVariables__i.interpolate({
file: paths.customVariables,
error
}));
}
})
.catch((error) => {
this.savingIsDisabled = true;
this.loggerService.error(this.lang.error.loadingError, { invokeAlert: true, alertTimeout: 5000, doNotAppendToLog: true });
this.loggerService.error(error);
});
}
})
.catch((error) => {
this.savingIsDisabled = true;
this.loggerService.error(this.lang.error.loadingError, { invokeAlert: true, alertTimeout: 5000, doNotAppendToLog: true });
this.loggerService.error(error);
});
}

set(data: CustomVariables) {
Expand Down

0 comments on commit 8d7a4fa

Please sign in to comment.