From 4ace27bbcc5672fb2f00407a42bf5c8bc3e37aec Mon Sep 17 00:00:00 2001 From: derrod Date: Fri, 29 May 2020 23:05:29 +0200 Subject: [PATCH] [lfs] Fix JSON writing and add delete_manifest method --- legendary/lfs/egl.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/legendary/lfs/egl.py b/legendary/lfs/egl.py index 2d11dce..f7de044 100644 --- a/legendary/lfs/egl.py +++ b/legendary/lfs/egl.py @@ -67,5 +67,12 @@ class EPCLFS: manifest_data = manifest.to_json() self.manifests[manifest.app_name] = manifest_data - with open(os.path.join(self.programdata_path, f'{manifest.installation_guid}.item', 'wb')) as f: + with open(os.path.join(self.programdata_path, f'{manifest.installation_guid}.item'), 'w') as f: json.dump(manifest_data, f, indent=4, sort_keys=True) + + def delete_manifest(self, app_name): + if app_name not in self.manifests: + raise ValueError('AppName is not in manifests!') + + manifest = EGLManifest.from_json(self.manifests.pop(app_name)) + os.remove(os.path.join(self.programdata_path, f'{manifest.installation_guid}.item'))