Skip to content

Commit

Permalink
Some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Dummerle committed Oct 7, 2021
1 parent 784d329 commit 9e79c0a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 20 deletions.
7 changes: 2 additions & 5 deletions legendary/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,6 @@ def install_game(self, args):
status_queue = MPQueue()

logger.info('Preparing download...')
# todo use status queue to print progress from CLI
# This has become a little ridiculous hasn't it?
try:
dlm, analysis, game, igame, repair, repair_file, res = self.core.prepare_download(
Expand Down Expand Up @@ -802,10 +801,6 @@ def install_game(self, args):
logger.info(f'Reusable size: {analysis.reuse_size / 1024 / 1024:.02f} MiB (chunks) / '
f'{analysis.unchanged / 1024 / 1024:.02f} MiB (unchanged / skipped)')

res = self.core.check_installation_conditions(analysis=analysis, install=igame, game=game,
updating=self.core.is_installed(args.app_name),
ignore_space_req=args.ignore_space)

if not args.yes:
if not get_boolean_choice(f'Do you wish to install "{igame.title}"?'):
print('Aborting...')
Expand Down Expand Up @@ -896,6 +891,8 @@ def verify_game(self, args, print_command=True):
self.core.verify_game(app_name=args.app_name, callback=self.output_progress)
except Exception as e:
logger.error(e)
if print_command:
logger.info(f'Run "legendary repair {args.app_name}" to repair your game installation.')

def _handle_postinstall(self, postinstall, igame, yes=False):
print('This game lists the following prequisites to be installed:')
Expand Down
16 changes: 1 addition & 15 deletions legendary/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1127,22 +1127,8 @@ def prepare_download(self, app_name: str, base_path: str = '', no_install: bool

# game is either up to date or hasn't changed, so we have nothing to do
if not anlres.dl_size:
old_igame = self.get_installed_game(game.app_name)
self.log.info('Download size is 0, the game is either already up to date or has not changed. Exiting...')
if old_igame and repair and os.path.exists(repair_file):
if old_igame.needs_verification:
old_igame.needs_verification = False
self.install_game(old_igame)

self.log.debug('Removing repair file.')
os.remove(repair_file)

# check if install tags have changed, if they did; try deleting files that are no longer required.
if old_igame and old_igame.install_tags != igame.install_tags:
old_igame.install_tags = igame.install_tags
self.log.info('Deleting now untagged files.')
self.uninstall_tag(old_igame)
self.install_game(old_igame)
self.clean_post_install(game, igame, repair, repair_file)

raise RuntimeError('Nothing to do.')

Expand Down

0 comments on commit 9e79c0a

Please sign in to comment.