From 115d0f0531f06a91893a0dea5212ede6c1dbb1fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mika=C3=ABl=20Capelle?= Date: Thu, 11 Jun 2020 23:48:57 +0200 Subject: [PATCH] Add Steam installation folder to the list of library folder. --- steam_utils.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/steam_utils.py b/steam_utils.py index 90dda0f..94108e4 100644 --- a/steam_utils.py +++ b/steam_utils.py @@ -1,5 +1,7 @@ # -*- encoding: utf-8 -*- +# Code greatly inspired by https://github.com/LostDragonist/steam-library-setup-tool + import os import winreg # type: ignore @@ -37,9 +39,9 @@ class LibraryFolder: if i is not None and n is not None: break - if i is None or n is None: - continue - self.games.append(SteamGame(i, n)) + if i is None or n is None: + continue + self.games.append(SteamGame(i, n)) def __repr__(self): return str(self) @@ -54,7 +56,7 @@ def parse_library_info(library_vdf_path): with open(library_vdf_path, "r") as f: - # Find the line containing "LibnraryFolders" (quoted): + # Find the line containing "LibraryFolders" (quoted): it = iter(f) for line in it: @@ -102,10 +104,11 @@ def find_games() -> Dict[str, str]: return {} library_vdf_path = os.path.join( - os.path.split(steam_path)[0], "steamapps", "libraryfolders.vdf" + os.path.dirname(steam_path), "steamapps", "libraryfolders.vdf" ) library_folders = parse_library_info(library_vdf_path) + library_folders.append(LibraryFolder(os.path.dirname(steam_path))) games: Dict[str, str] = {} for library in library_folders: