mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 17:55:27 +00:00
[core/lfs] Remove unversioned local manifest saving/loading
This commit is contained in:
parent
effc74b73b
commit
83e3af344f
|
@ -713,7 +713,6 @@ class LegendaryCore:
|
|||
self.log.info('Parsing game manifest...')
|
||||
new_manifest = self.load_manifest(new_manifest_data)
|
||||
self.log.debug(f'Base urls: {base_urls}')
|
||||
self.lgd.save_manifest(game.app_name, new_manifest_data)
|
||||
# save manifest with version name as well for testing/downgrading/etc.
|
||||
self.lgd.save_manifest(game.app_name, new_manifest_data,
|
||||
version=new_manifest.meta.build_version)
|
||||
|
@ -960,7 +959,6 @@ class LegendaryCore:
|
|||
|
||||
# parse and save manifest to disk for verification step of import
|
||||
new_manifest = self.load_manifest(manifest_data)
|
||||
self.lgd.save_manifest(game.app_name, manifest_data)
|
||||
self.lgd.save_manifest(game.app_name, manifest_data,
|
||||
version=new_manifest.meta.build_version)
|
||||
install_size = sum(fm.file_size for fm in new_manifest.file_manifest_list.elements)
|
||||
|
@ -1031,7 +1029,6 @@ class LegendaryCore:
|
|||
with open(manifest_filename, 'rb') as f:
|
||||
manifest_data = f.read()
|
||||
new_manifest = self.load_manifest(manifest_data)
|
||||
self.lgd.save_manifest(lgd_igame.app_name, manifest_data)
|
||||
self.lgd.save_manifest(lgd_igame.app_name, manifest_data,
|
||||
version=new_manifest.meta.build_version)
|
||||
# mark game as installed
|
||||
|
|
|
@ -31,7 +31,7 @@ class LGDLFS:
|
|||
self.config.optionxform = str
|
||||
|
||||
# ensure folders exist.
|
||||
for f in ['', 'manifests', 'metadata', 'tmp', 'manifests/old']:
|
||||
for f in ['', 'manifests', 'metadata', 'tmp']:
|
||||
if not os.path.exists(os.path.join(self.path, f)):
|
||||
os.makedirs(os.path.join(self.path, f))
|
||||
|
||||
|
@ -123,21 +123,17 @@ class LGDLFS:
|
|||
open(os.path.join(self.path, 'assets.json'), 'w'),
|
||||
indent=2, sort_keys=True)
|
||||
|
||||
def _get_manifest_filename(self, app_name, version=''):
|
||||
if not version:
|
||||
return 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}')
|
||||
return os.path.join(self.path, 'manifests', 'old', f'{fname}.manifest')
|
||||
def _get_manifest_filename(self, app_name, version):
|
||||
fname = clean_filename(f'{app_name}_{version}')
|
||||
return os.path.join(self.path, 'manifests', f'{fname}.manifest')
|
||||
|
||||
def load_manifest(self, app_name, version=''):
|
||||
def load_manifest(self, app_name, version):
|
||||
try:
|
||||
return open(self._get_manifest_filename(app_name, version), 'rb').read()
|
||||
except FileNotFoundError: # all other errors should propagate
|
||||
return None
|
||||
|
||||
def save_manifest(self, app_name, manifest_data, version=''):
|
||||
def save_manifest(self, app_name, manifest_data, version):
|
||||
with open(self._get_manifest_filename(app_name, version), 'wb') as f:
|
||||
f.write(manifest_data)
|
||||
|
||||
|
|
Loading…
Reference in a new issue