Skip to content

Commit

Permalink
Check for existing wgs folder before proceeding
Browse files Browse the repository at this point in the history
  • Loading branch information
Z1ni committed Sep 6, 2023
1 parent 13865c4 commit 3fef287
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def read_utf16_str(f, str_len=None):
def read_containers(pkg_name):
# Find container dir
wgs_dir = os.path.expandvars(f"%LOCALAPPDATA%\\Packages\\{pkg_name}\\SystemAppData\\wgs")
if not os.path.isdir(wgs_dir):
return None
# Get the correct user directory
dirs = [d for d in os.listdir(wgs_dir) if d != "t"]
dir_count = len(dirs)
Expand Down Expand Up @@ -250,7 +252,12 @@ def main():
print("- %s" % name)

try:
store_pkg_name, containers = read_containers(supported_xgp_apps[name])
read_result = read_containers(supported_xgp_apps[name])
if read_result is None:
print(" No containers for the game, maybe the game is not installed anymore")
print()
continue
store_pkg_name, containers = read_result

# Get save file paths
save_paths = get_save_paths(store_pkg_name, containers, temp_dir)
Expand All @@ -268,11 +275,11 @@ def main():

print()
print(" Save files written to \"%s\"" % zip_name)
print()

except Exception:
print(f" Failed to extract saves:")
traceback.print_exc()
print()

temp_dir.cleanup()

Expand Down

0 comments on commit 3fef287

Please sign in to comment.