mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 17:55:27 +00:00
[core/cli] Warn/Fail if game requires Uplay
Addresses #69 but does not fix it.
This commit is contained in:
parent
3310f7e7a7
commit
8206283755
|
@ -618,21 +618,23 @@ class LegendaryCLI:
|
||||||
logger.info(f'Reusable size: {analysis.reuse_size / 1024 / 1024:.02f} MiB (chunks) / '
|
logger.info(f'Reusable size: {analysis.reuse_size / 1024 / 1024:.02f} MiB (chunks) / '
|
||||||
f'{analysis.unchanged / 1024 / 1024:.02f} MiB (unchanged)')
|
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),
|
updating=self.core.is_installed(args.app_name),
|
||||||
ignore_space_req=args.ignore_space)
|
ignore_space_req=args.ignore_space)
|
||||||
|
|
||||||
if res.failures:
|
if res.warnings or res.failures:
|
||||||
logger.fatal('Download cannot proceed, the following errors occured:')
|
logger.info('Installation requirements check returned the following results:')
|
||||||
for msg in sorted(res.failures):
|
|
||||||
logger.fatal(msg)
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
if res.warnings:
|
if res.warnings:
|
||||||
logger.warning('Installation requirements check returned the following warnings:')
|
|
||||||
for warn in sorted(res.warnings):
|
for warn in sorted(res.warnings):
|
||||||
logger.warning(warn)
|
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 '
|
logger.info('Downloads are resumable, you can interrupt the download with '
|
||||||
'CTRL-C and resume it using the same command later on.')
|
'CTRL-C and resume it using the same command later on.')
|
||||||
|
|
||||||
|
|
|
@ -833,6 +833,7 @@ class LegendaryCore:
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def check_installation_conditions(analysis: AnalysisResult,
|
def check_installation_conditions(analysis: AnalysisResult,
|
||||||
install: InstalledGame,
|
install: InstalledGame,
|
||||||
|
game: Game,
|
||||||
updating: bool = False,
|
updating: bool = False,
|
||||||
ignore_space_req: bool = False) -> ConditionCheckResult:
|
ignore_space_req: bool = False) -> ConditionCheckResult:
|
||||||
results = ConditionCheckResult(failures=set(), warnings=set())
|
results = ConditionCheckResult(failures=set(), warnings=set())
|
||||||
|
@ -871,6 +872,26 @@ class LegendaryCore:
|
||||||
results.failures.add(f'Not enough available disk space!'
|
results.failures.add(f'Not enough available disk space!'
|
||||||
f'{free_mib:.02f} MiB < {required_mib:.02f} MiB')
|
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
|
return results
|
||||||
|
|
||||||
def get_default_install_dir(self):
|
def get_default_install_dir(self):
|
||||||
|
|
Loading…
Reference in a new issue