Fix custom install locations check logic

This commit is contained in:
kramo
2023-05-27 14:03:09 +02:00
parent bff225572e
commit d05a03dee7
8 changed files with 74 additions and 98 deletions

View File

@@ -90,11 +90,11 @@ def get_game(task, datatypes, current_time, appmanifest, steam_dir):
open_file.raise_for_status()
content = open_file.json()
except requests.exceptions.RequestException:
task.return_value((values, image_path if image_path.exists() else None))
task.return_value((values, image_path if image_path.is_file() else None))
return
values = update_values_from_data(content, values)
task.return_value((values, image_path if image_path.exists() else None))
task.return_value((values, image_path if image_path.is_file() else None))
def get_games_async(appmanifests, steam_dir, importer):
@@ -129,25 +129,22 @@ def steam_installed(path=None):
steam_dir = Path(shared.schema.get_string(location_key)).expanduser()
check = "steamapps"
if not (steam_dir / check).is_file():
subdirs = ("steam", "Steam")
locations = (
(path,)
if path
else (
steam_dir,
Path.home() / ".steam",
shared.data_dir / "Steam",
Path.home() / ".var/app/com.valvesoftware.Steam/data/Steam",
)
subdirs = ("steam", "Steam")
locations = (
(path,)
if path
else (
steam_dir,
Path.home() / ".steam",
shared.data_dir / "Steam",
Path.home() / ".var/app/com.valvesoftware.Steam/data/Steam",
)
)
if os.name == "nt":
locations += (Path(os.getenv("programfiles(x86)")) / "Steam",)
if os.name == "nt":
locations += (Path(os.getenv("programfiles(x86)")) / "Steam",)
steam_dir = check_install(
check, locations, (shared.schema, location_key), subdirs
)
steam_dir = check_install(check, locations, (shared.schema, location_key), subdirs)
return steam_dir
@@ -168,7 +165,7 @@ def steam_importer():
steam_dirs = [steam_dir]
for directory in steam_dirs:
if not (directory / "steamapps").exists():
if not (directory / "steamapps").is_dir():
steam_dirs.remove(directory)
for directory in steam_dirs: