mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 17:55:27 +00:00
[cli] Check for game exe on import and add check override
This commit is contained in:
parent
f3f86836c8
commit
9867c5f492
|
@ -716,16 +716,21 @@ class LegendaryCLI:
|
||||||
# todo: if there is an Epic Games Launcher manifest in the install path use that instead
|
# todo: if there is an Epic Games Launcher manifest in the install path use that instead
|
||||||
# get everything needed for import from core, then run additional checks.
|
# get everything needed for import from core, then run additional checks.
|
||||||
manifest, igame = self.core.import_game(game, args.app_path)
|
manifest, igame = self.core.import_game(game, args.app_path)
|
||||||
|
exe_path = os.path.join(args.app_path, manifest.meta.launch_exe.lstrip('/'))
|
||||||
# check if most files at least exist or if user might have specified the wrong directory
|
# check if most files at least exist or if user might have specified the wrong directory
|
||||||
total = len(manifest.file_manifest_list.elements)
|
total = len(manifest.file_manifest_list.elements)
|
||||||
found = sum(os.path.exists(os.path.join(args.app_path, f.filename))
|
found = sum(os.path.exists(os.path.join(args.app_path, f.filename))
|
||||||
for f in manifest.file_manifest_list.elements)
|
for f in manifest.file_manifest_list.elements)
|
||||||
if found != total:
|
ratio = found / total
|
||||||
ratio = found / total
|
|
||||||
if ratio < 0.95:
|
if not os.path.exists(exe_path and not args.disable_check):
|
||||||
logger.fatal(f'{total-found}/{total} files are missing, cannot import.')
|
logger.error(f'Game executable could not be found at "{exe_path}", '
|
||||||
exit(1)
|
f'please verify that the specified path is correct.')
|
||||||
logger.warning('Some files are missing from the game installation, this may be due to newer updates.')
|
exit(1)
|
||||||
|
|
||||||
|
if ratio < 0.95:
|
||||||
|
logger.warning('Some files are missing from the game installation, install may not '
|
||||||
|
'match latest Epic Games Store version or might be corrupted.')
|
||||||
else:
|
else:
|
||||||
logger.info('Game install appears to be complete.')
|
logger.info('Game install appears to be complete.')
|
||||||
|
|
||||||
|
@ -900,6 +905,9 @@ def main():
|
||||||
sync_saves_parser.add_argument('--disable-filters', dest='disable_filters', action='store_true',
|
sync_saves_parser.add_argument('--disable-filters', dest='disable_filters', action='store_true',
|
||||||
help='Disable save game file filtering (in case it breaks)')
|
help='Disable save game file filtering (in case it breaks)')
|
||||||
|
|
||||||
|
import_parser.add_argument('--disable-check', dest='disable_check', action='store_true',
|
||||||
|
help='Disables checks of specified game install.')
|
||||||
|
|
||||||
args, extra = parser.parse_known_args()
|
args, extra = parser.parse_known_args()
|
||||||
|
|
||||||
if args.version:
|
if args.version:
|
||||||
|
|
Loading…
Reference in a new issue