Skip to content

Commit ad41691

Browse files
committed
Fix VDF Key Error
1 parent 2dd0c0a commit ad41691

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

steamCloudSaveDownloaderGUI/data_provider.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,21 @@ def get_games_last_played_time_locally() -> dict:
3939

4040
vdf_location = os.path.join(core.s_steam_location, "userdata", str(account_id), 'config', "localconfig.vdf")
4141
if not os.path.isfile(vdf_location):
42-
return
42+
return {}
4343
local_vdf = vdf.load(open(vdf_location, encoding='utf-8'))
4444

4545
played_time = {}
4646

47-
for key, value in local_vdf['UserLocalConfigStore']['Software']['valve']['Steam']['apps'].items():
47+
try:
48+
items = local_vdf['UserLocalConfigStore']['Software']['valve']['Steam']['apps'].items()
49+
except:
50+
try:
51+
# Might be lower case
52+
items = local_vdf['UserLocalConfigStore']['Software']['Valve']['Steam']['apps'].items()
53+
except:
54+
return {}
55+
56+
for key, value in items:
4857
if 'LastPlayed' not in value:
4958
continue
5059
played_time[int(key)] = \

0 commit comments

Comments
 (0)