fix: checkboxes changes saved

This commit is contained in:
RedDeadDepresso
2024-07-24 03:46:19 +01:00
parent 7a6d956c48
commit 977f701eef
14 changed files with 388 additions and 309 deletions

View File

@@ -1,24 +1,25 @@
import os
class CreateBackup:
def __init__(self, config, file_manager):
"""Initializes the Bounty module.
from app.common.file_manager import fileManager
from app.modules.handler import Handler
Args:
config (Config): BAAuto Config instance
"""
self.config = config
self.file_manager = file_manager
self.backup_folders = self.config.create_backup["GameFolders"]
self.filename = self.config.create_backup["Filename"]
self.output_path = self.config.create_backup["OutputPath"]
self.game_path = self.config.game_path
class CreateBackup(Handler):
def __str__(self) -> str:
return "Create Backup"
def logic_wrapper(self):
selected_folders = [self.game_path[folder] for folder in self.backup_folders if self.backup_folders[folder]]
output_path = os.path.join(self.output_path, self.filename)
self.file_manager.create_archive(selected_folders, output_path)
def loadConfig(self, config):
super().loadConfig(config)
folders = ["mods", "UserData", "BepInEx"]
self.folders = [self.gamePath[f] for f in folders if self.config[f]]
self.outputPath = self.config["OutputPath"]
self.filename = self.config["Filename"]
def handle(self, request):
outputPath = os.path.join(self.outputPath, self.filename)
fileManager.createArchive(self.folders, outputPath)
self.setNext(request)