mirror of
https://github.com/derrod/legendary.git
synced 2024-12-22 17:55:27 +00:00
[core] Fix save path when downloading multiple saves
This commit is contained in:
parent
0e2a61aca5
commit
8d46d7ad2e
|
@ -488,6 +488,7 @@ class LegendaryCore:
|
||||||
if not os.path.exists(save_path):
|
if not os.path.exists(save_path):
|
||||||
os.makedirs(save_path)
|
os.makedirs(save_path)
|
||||||
|
|
||||||
|
_save_dir = save_dir
|
||||||
savegames = self.egs.get_user_cloud_saves(app_name=app_name)
|
savegames = self.egs.get_user_cloud_saves(app_name=app_name)
|
||||||
files = savegames['files']
|
files = savegames['files']
|
||||||
for fname, f in files.items():
|
for fname, f in files.items():
|
||||||
|
@ -498,13 +499,13 @@ class LegendaryCore:
|
||||||
if manifest_name and f_parts[4] != manifest_name:
|
if manifest_name and f_parts[4] != manifest_name:
|
||||||
continue
|
continue
|
||||||
if not save_dir:
|
if not save_dir:
|
||||||
save_dir = os.path.join(save_path, f'{f_parts[2]}/{f_parts[4].rpartition(".")[0]}')
|
_save_dir = os.path.join(save_path, f'{f_parts[2]}/{f_parts[4].rpartition(".")[0]}')
|
||||||
if not os.path.exists(save_dir):
|
if not os.path.exists(_save_dir):
|
||||||
os.makedirs(save_dir)
|
os.makedirs(_save_dir)
|
||||||
|
|
||||||
if clean_dir:
|
if clean_dir:
|
||||||
self.log.info('Deleting old save files...')
|
self.log.info('Deleting old save files...')
|
||||||
delete_folder(save_dir)
|
delete_folder(_save_dir)
|
||||||
|
|
||||||
self.log.info(f'Downloading "{fname.split("/", 2)[2]}"...')
|
self.log.info(f'Downloading "{fname.split("/", 2)[2]}"...')
|
||||||
# download manifest
|
# download manifest
|
||||||
|
@ -530,7 +531,7 @@ class LegendaryCore:
|
||||||
|
|
||||||
for fm in m.file_manifest_list.elements:
|
for fm in m.file_manifest_list.elements:
|
||||||
dirs, fname = os.path.split(fm.filename)
|
dirs, fname = os.path.split(fm.filename)
|
||||||
fdir = os.path.join(save_dir, dirs)
|
fdir = os.path.join(_save_dir, dirs)
|
||||||
fpath = os.path.join(fdir, fname)
|
fpath = os.path.join(fdir, fname)
|
||||||
if not os.path.exists(fdir):
|
if not os.path.exists(fdir):
|
||||||
os.makedirs(fdir)
|
os.makedirs(fdir)
|
||||||
|
|
Loading…
Reference in a new issue