def _finish_install(self): game = self.installer.script.get("game") launcher_value = None if game: _launcher, launcher_value = get_game_launcher( self.installer.script) path = None if launcher_value: path = self._substitute(launcher_value) if not os.path.isabs(path) and self.target_path: path = os.path.join(self.target_path, path) self.installer.save() if path and not os.path.isfile(path) and self.installer.runner not in ( "web", "browser"): self.parent.set_status( _("The executable at path %s can't be found, please check the destination folder.\n" "Some parts of the installation process may have not completed successfully." ) % path) logger.warning("No executable found at specified location %s", path) else: install_complete_text = ( self.installer.script.get("install_complete_text") or _("Installation completed!")) self.parent.set_status(install_complete_text) download_lutris_media(self.installer.game_slug) self.parent.on_install_finished()
def scan_directory(dirname): slugs_map = get_game_slugs_and_folders(dirname) directories = get_used_directories() api_games = get_api_games(list(slugs_map.keys())) slugs_seen = set() slugs_installed = set() for api_game in api_games: if api_game["slug"] in slugs_seen: continue slugs_seen.add(api_game["slug"]) game_folder = find_game_folder(dirname, api_game, slugs_map) if game_folder in directories: slugs_installed.add(api_game["slug"]) continue full_path, installer = find_game(game_folder, api_game) if full_path: logger.info("Found %s in %s", api_game["name"], full_path) try: install_game(installer, game_folder) except MissingGameDependency as ex: logger.error("Skipped %s: %s", api_game["name"], ex) download_lutris_media(installer["game_slug"]) slugs_installed.add(api_game["slug"]) installed_map = {slug: folder for slug, folder in slugs_map.items() if slug in slugs_installed} missing_map = {slug: folder for slug, folder in slugs_map.items() if slug not in slugs_installed} return installed_map, missing_map