From 63951d76ac3f576001afcaa7d81890e0afd2bed3 Mon Sep 17 00:00:00 2001 From: kramo <93832451+kra-mo@users.noreply.github.com> Date: Sat, 27 May 2023 17:53:08 +0200 Subject: [PATCH] Fix custom path check logic --- src/importers/bottles_importer.py | 1 + src/importers/heroic_importer.py | 1 + src/importers/itch_importer.py | 1 + src/importers/lutris_importer.py | 2 ++ src/importers/steam_importer.py | 16 +++++++--------- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/importers/bottles_importer.py b/src/importers/bottles_importer.py index a3dc147..8da7dcf 100644 --- a/src/importers/bottles_importer.py +++ b/src/importers/bottles_importer.py @@ -34,6 +34,7 @@ def bottles_installed(path=None): (path,) if path else ( + Path(shared.schema.get_string(location_key)).expanduser(), Path.home() / ".var/app/com.usebottles.bottles/data/bottles", shared.data_dir / "bottles", ) diff --git a/src/importers/heroic_importer.py b/src/importers/heroic_importer.py index 9aa5415..001bde2 100644 --- a/src/importers/heroic_importer.py +++ b/src/importers/heroic_importer.py @@ -35,6 +35,7 @@ def heroic_installed(path=None): (path,) if path else ( + Path(shared.schema.get_string(location_key)).expanduser(), Path.home() / ".var/app/com.heroicgameslauncher.hgl/config/heroic", shared.config_dir / "heroic", ) diff --git a/src/importers/itch_importer.py b/src/importers/itch_importer.py index 6f7e7e5..4b44d1f 100644 --- a/src/importers/itch_importer.py +++ b/src/importers/itch_importer.py @@ -129,6 +129,7 @@ def itch_installed(path=None): (path,) if path else ( + Path(shared.schema.get_string(location_key)).expanduser(), Path.home() / ".var/app/io.itch.itch/config/itch", shared.config_dir / "itch", ) diff --git a/src/importers/lutris_importer.py b/src/importers/lutris_importer.py index 3b7450c..c2f3030 100644 --- a/src/importers/lutris_importer.py +++ b/src/importers/lutris_importer.py @@ -34,6 +34,7 @@ def lutris_installed(path=None): (path,) if path else ( + Path(shared.schema.get_string(location_key)).expanduser(), Path.home() / ".var/app/net.lutris.Lutris/data/lutris", shared.data_dir / "lutris", ) @@ -52,6 +53,7 @@ def lutris_cache_exists(path=None): (path,) if path else ( + Path(shared.schema.get_string(cache_key)).expanduser(), Path.home() / ".var" / "app" / "net.lutris.Lutris" / "cache" / "lutris", shared.cache_dir / "lutris", ) diff --git a/src/importers/steam_importer.py b/src/importers/steam_importer.py index 44a397c..0693d54 100644 --- a/src/importers/steam_importer.py +++ b/src/importers/steam_importer.py @@ -126,7 +126,6 @@ def get_games_async(appmanifests, steam_dir, importer): def steam_installed(path=None): location_key = "steam-location" - steam_dir = Path(shared.schema.get_string(location_key)).expanduser() check = "steamapps" subdirs = ("steam", "Steam") @@ -134,7 +133,7 @@ def steam_installed(path=None): (path,) if path else ( - steam_dir, + Path(shared.schema.get_string(location_key)).expanduser(), Path.home() / ".steam", shared.data_dir / "Steam", Path.home() / ".var/app/com.valvesoftware.Steam/data/Steam", @@ -165,13 +164,12 @@ def steam_importer(): steam_dirs = [steam_dir] for directory in steam_dirs: - if not (directory / "steamapps").is_dir(): - steam_dirs.remove(directory) - - for directory in steam_dirs: - for open_file in (directory / "steamapps").iterdir(): - if open_file.is_file() and "appmanifest" in open_file.name: - appmanifests.append(open_file) + try: + for open_file in (directory / "steamapps").iterdir(): + if open_file.is_file() and "appmanifest" in open_file.name: + appmanifests.append(open_file) + except FileNotFoundError: + continue importer = shared.importer importer.total_queue += len(appmanifests)