[core/cli] Warn/Fail if game requires Uplay

Addresses #69 but does not fix it.
This commit is contained in:
derrod 2020-11-02 19:08:06 +01:00
parent 3310f7e7a7
commit 8206283755
2 changed files with 30 additions and 7 deletions

View file

@ -618,21 +618,23 @@ class LegendaryCLI:
logger.info(f'Reusable size: {analysis.reuse_size / 1024 / 1024:.02f} MiB (chunks) / '
f'{analysis.unchanged / 1024 / 1024:.02f} MiB (unchanged)')
res = self.core.check_installation_conditions(analysis=analysis, install=igame,
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 res.failures:
logger.fatal('Download cannot proceed, the following errors occured:')
for msg in sorted(res.failures):
logger.fatal(msg)
exit(1)
if res.warnings or res.failures:
logger.info('Installation requirements check returned the following results:')
if res.warnings:
logger.warning('Installation requirements check returned the following warnings:')
for warn in sorted(res.warnings):
logger.warning(warn)
if res.failures:
for msg in sorted(res.failures):
logger.fatal(msg)
logger.error('Installation cannot proceed, exiting.')
exit(1)
logger.info('Downloads are resumable, you can interrupt the download with '
'CTRL-C and resume it using the same command later on.')

View file

@ -833,6 +833,7 @@ class LegendaryCore:
@staticmethod
def check_installation_conditions(analysis: AnalysisResult,
install: InstalledGame,
game: Game,
updating: bool = False,
ignore_space_req: bool = False) -> ConditionCheckResult:
results = ConditionCheckResult(failures=set(), warnings=set())
@ -871,6 +872,26 @@ class LegendaryCore:
results.failures.add(f'Not enough available disk space!'
f'{free_mib:.02f} MiB < {required_mib:.02f} MiB')
# check if the game actually ships the files or just a uplay installer + packed game files
executables = [f for f in analysis.manifest_comparison.added if
f.endswith('.exe') and not f.startswith('Installer/')]
if not any('uplay' not in e.lower() for e in executables):
results.failures.add('This game requires installation via Uplay and does not ship executable game files.')
# check if the game launches via uplay
if install.executable == 'UplayLaunch.exe':
results.warnings.add('This game requires launching via Uplay, it is recommended to install the game '
'via Uplay instead.')
# check if the game requires linking to an external account first
partner_link = game.metadata.get('customAttributes', {}).get('partnerLinkType', {}).get('value', None)
if partner_link == 'ubisoft':
results.warnings.add('This game requires linking to and activating on a Ubisoft account first, '
'this is not currently supported.')
elif partner_link:
results.warnings.add(f'This game requires linking to "{partner_link}", '
f'this is currently unsupported and the game may not work.')
return results
def get_default_install_dir(self):