From 9df3355200ae8c90a6f789a67347462c45a16159 Mon Sep 17 00:00:00 2001 From: loathingKernel <142770+loathingKernel@users.noreply.github.com> Date: Mon, 11 Jul 2022 23:03:17 +0300 Subject: [PATCH] LegendaryUtils: Remove dead re-implemented functions --- rare/utils/legendary_utils.py | 55 ----------------------------------- 1 file changed, 55 deletions(-) diff --git a/rare/utils/legendary_utils.py b/rare/utils/legendary_utils.py index d56b2841..32cf1508 100644 --- a/rare/utils/legendary_utils.py +++ b/rare/utils/legendary_utils.py @@ -131,58 +131,3 @@ def resolve_aliases(core: LegendaryCore, name): fallback=core.lgd.aliases.get(name.lower(), name) ) - -def import_game(core: LegendaryCore, app_name: str, path: str) -> str: - _tr = QCoreApplication.translate - logger.info(f"Import {app_name}") - game = core.get_game(app_name, update_meta=False) - if not game: - return _tr("LgdUtils", "Could not get game for {}").format(app_name) - - if core.is_installed(app_name): - logger.error(f"{game.app_title} is already installed") - return _tr("LgdUtils", "{} is already installed").format(game.app_title) - - if not os.path.exists(path): - logger.error("Path does not exist") - return _tr("LgdUtils", "Path does not exist") - - manifest, igame = core.import_game(game, path) - exe_path = os.path.join(path, manifest.meta.launch_exe.lstrip("/")) - - if not os.path.exists(exe_path): - logger.error(f"Launch Executable of {game.app_title} does not exist") - return _tr("LgdUtils", "Launch executable of {} does not exist").format( - game.app_title - ) - - if game.is_dlc: - release_info = game.metadata.get("mainGameItem", {}).get("releaseInfo") - if release_info: - main_game_appname = release_info[0]["appId"] - main_game_title = game.metadata["mainGameItem"]["title"] - if not core.is_installed(main_game_appname): - return _tr("LgdUtils", "Game is a DLC, but {} is not installed").format( - main_game_title - ) - else: - return _tr("LgdUtils", "Unable to get base game information for DLC") - - total = len(manifest.file_manifest_list.elements) - found = sum( - os.path.exists(os.path.join(path, f.filename)) - for f in manifest.file_manifest_list.elements - ) - ratio = found / total - - if ratio < 0.9: - logger.warning( - "Game files are missing. It may be not the latest version or it is corrupt" - ) - # return False - core.install_game(igame) - if igame.needs_verification: - logger.info(f"{igame.title} needs verification") - - logger.info(f"Successfully imported Game: {game.app_title}") - return ""