def remove(self, from_library=False, from_disk=False): """Uninstall a game Params: from_library (bool): Completely remove the game from library, do not set it as uninstalled from_disk (bool): Delete the game files Return: bool: Updated value for from_library """ if from_disk and self.runner: logger.debug("Removing game %s from disk", self.id) self.runner.remove_game_data(game_path=self.directory) # Do not keep multiple copies of the same game existing_games = pga.get_games_where(slug=self.slug) if len(existing_games) > 1: from_library = True if from_library: logger.debug("Removing game %s from library", self.id) pga.delete_game(self.id) else: pga.set_uninstalled(self.id) if self.config: self.config.remove() xdgshortcuts.remove_launcher(self.slug, self.id, desktop=True, menu=True) self.is_installed = False self.emit("game-removed") return from_library
def remove(self, from_library=False, from_disk=False): if from_disk: self.runner.remove_game_data(game_path=self.directory) if from_library: pga.delete_game(self.slug) self.config.remove() else: pga.set_uninstalled(self.slug)
def remove(self, from_library=False, from_disk=False): if from_disk: if os.path.exists(self.directory): shutil.rmtree(self.directory) if from_library: pga.delete_game(self.slug) else: pga.set_uninstalled(self.slug) self.game_config.remove()
def remove(self, from_library=False, from_disk=False): if from_disk: if os.path.exists(self.directory): shutil.rmtree(self.directory) if from_library: pga.delete_game(self.slug) else: pga.set_uninstalled(self.slug) self.config.remove()
def remove(self, from_library=False, from_disk=False): if from_disk: self.runner.remove_game_data(game_path=self.directory) if from_library: pga.delete_game(self.slug) self.config.remove() else: pga.set_uninstalled(self.slug) shortcuts.remove_launcher(self.slug, desktop=True, menu=True)
def remove(self, from_library=False, from_disk=False): if from_disk: logger.debug("Removing game %s from disk" % self.id) self.runner.remove_game_data(game_path=self.directory) if from_library: logger.debug("Removing game %s from library" % self.id) pga.delete_game(self.id) else: pga.set_uninstalled(self.id) self.config.remove() shortcuts.remove_launcher(self.slug, self.id, desktop=True, menu=True)
def remove(self, from_library=False, from_disk=False): if from_disk and self.runner: logger.debug("Removing game %s from disk" % self.id) self.runner.remove_game_data(game_path=self.directory) # Do not keep multiple copies of the same game existing_games = pga.get_game_by_field(self.slug, 'slug', all=True) if len(existing_games) > 1: from_library = True if from_library: logger.debug("Removing game %s from library" % self.id) pga.delete_game(self.id) else: pga.set_uninstalled(self.id) self.config.remove() shortcuts.remove_launcher(self.slug, self.id, desktop=True, menu=True) return from_library
def remove(self, from_library=False, from_disk=False): if from_disk and self.runner: logger.debug("Removing game %s from disk", self.id) self.runner.remove_game_data(game_path=self.directory) # Do not keep multiple copies of the same game existing_games = pga.get_games_where(slug=self.slug) if len(existing_games) > 1: from_library = True if from_library: logger.debug("Removing game %s from library", self.id) pga.delete_game(self.id) else: pga.set_uninstalled(self.id) if self.config: self.config.remove() xdgshortcuts.remove_launcher(self.slug, self.id, desktop=True, menu=True) self.is_installed = False self.emit("game-removed") return from_library
def test_delete_game(self): pga.delete_game(self.game_id) game_list = pga.get_games() self.assertEqual(len(game_list), 0) self.game_id = pga.add_game(name="LutrisTest", runner="Linux")
def remove(self, from_library=False, from_disk=False): if from_disk: shutil.rmtree(self.directory) if from_library: pga.delete_game(self.slug) self.game_config.remove()