mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 17:55:27 +00:00
[core/lfs] Load correct old manifest file after aborted installation
If a user were to start and then abort an installation previously we would have loaded the downloaded new manifest, rather than the one of the installed version. By explicitly setting the version we can avoid this.
This commit is contained in:
parent
78d745b03f
commit
a59107e503
|
@ -312,7 +312,8 @@ class LegendaryCore:
|
||||||
old_manifest_data = f.read()
|
old_manifest_data = f.read()
|
||||||
old_manifest = self.load_manfiest(old_manifest_data)
|
old_manifest = self.load_manfiest(old_manifest_data)
|
||||||
elif not disable_patching and not force and self.is_installed(game.app_name):
|
elif not disable_patching and not force and self.is_installed(game.app_name):
|
||||||
if old_bytes := self.lgd.get_manifest(game.app_name):
|
igame = self.get_installed_game(game.app_name)
|
||||||
|
if old_bytes := self.lgd.get_manifest(game.app_name, igame.version):
|
||||||
old_manifest = self.load_manfiest(old_bytes)
|
old_manifest = self.load_manfiest(old_bytes)
|
||||||
|
|
||||||
base_urls = list(game.base_urls) # copy list for manipulation
|
base_urls = list(game.base_urls) # copy list for manipulation
|
||||||
|
|
|
@ -116,8 +116,15 @@ class LGDLFS:
|
||||||
open(os.path.join(self.path, 'assets.json'), 'w'),
|
open(os.path.join(self.path, 'assets.json'), 'w'),
|
||||||
indent=2, sort_keys=True)
|
indent=2, sort_keys=True)
|
||||||
|
|
||||||
def get_manifest(self, app_name):
|
def get_manifest(self, app_name, version=''):
|
||||||
manifest_file = os.path.join(self.path, 'manifests', f'{app_name}.manifest')
|
if not version:
|
||||||
|
manifest_file = os.path.join(self.path, 'manifests', f'{app_name}.manifest')
|
||||||
|
else:
|
||||||
|
# if a version is specified load it from the versioned directory
|
||||||
|
fname = clean_filename(f'{app_name}_{version}')
|
||||||
|
manifest_file = os.path.join(self.path, 'manifests', 'old',
|
||||||
|
f'{fname}.manifest')
|
||||||
|
|
||||||
if os.path.exists(manifest_file):
|
if os.path.exists(manifest_file):
|
||||||
return open(manifest_file, 'rb').read()
|
return open(manifest_file, 'rb').read()
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in a new issue