[core] Honor existing installation directory

This prevents an issue where changing the base
path later on would cause an update to be written
to the wrong directory (or cause crashes).
This commit is contained in:
derrod 2020-05-16 11:01:13 +02:00
parent 532e1df237
commit e88a369feb

View file

@ -552,6 +552,10 @@ class LegendaryCore:
self.lgd.save_manifest(game.app_name, new_manifest_data, self.lgd.save_manifest(game.app_name, new_manifest_data,
version=new_manifest.meta.build_version) version=new_manifest.meta.build_version)
# reuse existing installation's directory
if igame := self.get_installed_game(base_game.app_name if base_game else game.app_name):
install_path = igame.install_path
else:
if not game_folder: if not game_folder:
if game.is_dlc: if game.is_dlc:
game_folder = base_game.metadata.get('customAttributes', {}).\ game_folder = base_game.metadata.get('customAttributes', {}).\
@ -569,6 +573,7 @@ class LegendaryCore:
os.makedirs(base_path) os.makedirs(base_path)
install_path = os.path.join(base_path, game_folder) install_path = os.path.join(base_path, game_folder)
self.log.info(f'Install path: {install_path}') self.log.info(f'Install path: {install_path}')
if not force: if not force: