diff --git a/rare/components/tabs/games/game_info/game_settings.py b/rare/components/tabs/games/game_info/game_settings.py index c64203d2..659dc86c 100644 --- a/rare/components/tabs/games/game_info/game_settings.py +++ b/rare/components/tabs/games/game_info/game_settings.py @@ -3,7 +3,7 @@ import platform from typing import Tuple from PyQt5.QtCore import QSettings -from PyQt5.QtWidgets import QWidget, QFileDialog, QMessageBox +from PyQt5.QtWidgets import QWidget, QFileDialog from legendary.core import LegendaryCore from legendary.models.game import InstalledGame, Game @@ -169,15 +169,8 @@ class GameSettings(QWidget, Ui_GameSettings): if not text: text = os.path.expanduser("~/.proton") return True, text - if not os.path.exists(text): - try: - os.makedirs(text) - except PermissionError: - QMessageBox.warning(self, "Warning", f"{self.tr('No permission to create folder')} {text}") - text = os.path.expanduser("~/.proton") - finally: - return True, text - return True, text + parent = os.path.dirname(text) + return os.path.exists(parent), text def proton_prefix_save(self, text: str): self.core.lgd.config.set(self.game.app_name + ".env", "STEAM_COMPAT_DATA_PATH", text) diff --git a/rare/utils/legendary_utils.py b/rare/utils/legendary_utils.py index e3780a42..f3183892 100644 --- a/rare/utils/legendary_utils.py +++ b/rare/utils/legendary_utils.py @@ -103,6 +103,22 @@ def uninstall(app_name: str, core: LegendaryCore, options=None): core.lgd.save_config() +def update_manifest(app_name: str, core: LegendaryCore): + game = core.get_game(app_name) + logger.info('Reloading game manifest of ' + game.app_title) + new_manifest_data, base_urls = core.get_cdn_manifest(game) + # overwrite base urls in metadata with current ones to avoid using old/dead CDNs + game.base_urls = base_urls + # save base urls to game metadata + core.lgd.set_game_meta(game.app_name, game) + + new_manifest = core.load_manifest(new_manifest_data) + logger.debug(f'Base urls: {base_urls}') + # save manifest with version name as well for testing/downgrading/etc. + core.lgd.save_manifest(game.app_name, new_manifest_data, + version=new_manifest.meta.build_version) + + class VerifyThread(QThread): status = pyqtSignal(tuple) summary = pyqtSignal(int, int, str) @@ -119,6 +135,13 @@ class VerifyThread(QThread): logger.info(f'Loading installed manifest for "{self.app_name}"') igame = self.core.get_installed_game(self.app_name) manifest_data, _ = self.core.get_installed_manifest(self.app_name) + if not manifest_data: + update_manifest(self.app_name, self.core) + manifest_data, _ = self.core.get_installed_manifest(self.app_name) + if not manifest_data: + self.summary.emit(0, 0, self.app_name) + return + manifest = self.core.load_manifest(manifest_data) files = sorted(manifest.file_manifest_list.elements,