mirror of
https://github.com/derrod/legendary.git
synced 2024-11-09 10:58:32 +00:00
[lfs] Check if AppData/ProgramData paths exist (#421)
This commit is contained in:
parent
a12238e4ef
commit
823d672c2c
|
@ -34,12 +34,18 @@ class EPCLFS:
|
|||
if not self.appdata_path:
|
||||
raise ValueError('EGS AppData path is not set')
|
||||
|
||||
if not os.path.isdir(self.appdata_path):
|
||||
raise ValueError('EGS AppData path does not exist')
|
||||
|
||||
self.config.read(os.path.join(self.appdata_path, 'GameUserSettings.ini'), encoding='utf-8')
|
||||
|
||||
def save_config(self):
|
||||
if not self.appdata_path:
|
||||
raise ValueError('EGS AppData path is not set')
|
||||
|
||||
if not os.path.isdir(self.appdata_path):
|
||||
raise ValueError('EGS AppData path does not exist')
|
||||
|
||||
with open(os.path.join(self.appdata_path, 'GameUserSettings.ini'), 'w', encoding='utf-8') as f:
|
||||
self.config.write(f, space_around_delimiters=False)
|
||||
|
||||
|
@ -47,6 +53,10 @@ class EPCLFS:
|
|||
if not self.programdata_path:
|
||||
raise ValueError('EGS ProgramData path is not set')
|
||||
|
||||
if not os.path.isdir(self.programdata_path):
|
||||
# Not sure if we should `raise` here as well
|
||||
return
|
||||
|
||||
for f in os.listdir(self.programdata_path):
|
||||
if f.endswith('.item'):
|
||||
data = json.load(open(os.path.join(self.programdata_path, f), encoding='utf-8'))
|
||||
|
@ -71,6 +81,9 @@ class EPCLFS:
|
|||
if not self.programdata_path:
|
||||
raise ValueError('EGS ProgramData path is not set')
|
||||
|
||||
if not os.path.isdir(self.programdata_path):
|
||||
raise ValueError('EGS ProgramData path does not exist')
|
||||
|
||||
manifest_data = manifest.to_json()
|
||||
self.manifests[manifest.app_name] = manifest_data
|
||||
_path = os.path.join(self.programdata_path, f'{manifest.installation_guid}.item')
|
||||
|
|
Loading…
Reference in a new issue