Skip to content

Commit 5a57407

Browse files
committed
fix(backups): reset backup path if not found
1 parent 88e35cc commit 5a57407

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

src/backend/backup-manager.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,13 @@ class BackupManager {
182182
manualActivation ? "_manual" : ""
183183
}.${fileExtension}`;
184184

185+
if (!fs.existsSync(this._backupFolderPath)) {
186+
logger.warn(`Backup path ${this._backupFolderPath} does not exist. Resetting to default.`);
187+
SettingsManager.deleteSetting("BackupLocation");
188+
this.updateBackupFolderPath();
189+
SettingsManager.saveSetting("BackupLocationReset", true);
190+
}
191+
185192
const output = fs.createWriteStream(path.join(this._backupFolderPath, filename));
186193
const archive = archiver(fileExtension, {
187194
zlib: { level: 9 }

src/gui/app/app-main.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261
});
262262

263263
app.controller("MainController", function($scope, $rootScope, $timeout, connectionService, utilityService,
264-
settingsService, backupService, sidebarManager, logger, backendCommunicator, fontManager, ngToast, watcherCountService) {
264+
settingsService, backupService, sidebarManager, logger, backendCommunicator, fontManager, ngToast, modalFactory) {
265265
$rootScope.showSpinner = true;
266266

267267
$scope.fontAwesome5KitUrl = `https://kit.fontawesome.com/${secrets.fontAwesome5KitId}.js`;
@@ -516,6 +516,11 @@
516516
keyboard: false,
517517
backdrop: "static"
518518
});*/
519+
520+
if (settingsService.getSetting("BackupLocationReset") === true) {
521+
modalFactory.showInfoModal("Your previous backup location could not be found. Backup location has been reset to default. You can change it in Settings > Backups.");
522+
settingsService.deleteSetting("BackupLocationReset");
523+
}
519524
});
520525

521526
// This adds a filter that we can use for ng-repeat, useful when we want to paginate something

src/types/settings.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export type FirebotSettingsTypes = {
3131
BackupIgnoreResources: boolean;
3232
BackupKeepAll: boolean;
3333
BackupLocation: string;
34+
BackupLocationReset: boolean;
3435
BackupOnceADay: boolean;
3536
BackupOnExit: boolean;
3637
ChatAlternateBackgrounds: boolean;
@@ -129,6 +130,7 @@ export const FirebotGlobalSettings: Partial<Record<keyof FirebotSettingsTypes, b
129130
BackupIgnoreResources: true,
130131
BackupKeepAll: true,
131132
BackupLocation: true,
133+
BackupLocationReset: true,
132134
BackupOnceADay: true,
133135
BackupOnExit: true,
134136
DebugMode: true,
@@ -166,6 +168,7 @@ export const FirebotSettingsDefaults: FirebotSettingsTypes = {
166168
BackupIgnoreResources: true,
167169
BackupKeepAll: false,
168170
BackupLocation: undefined,
171+
BackupLocationReset: false,
169172
BackupOnceADay: true,
170173
BackupOnExit: true,
171174
ChatAlternateBackgrounds: true,

0 commit comments

Comments
 (0)