Skip to content

Commit 4fae0e6

Browse files
Merge pull request #238 from termdisc/master
Fix account ID determination to allow proper importing of demo save files
2 parents 55dd59c + 351048b commit 4fae0e6

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

gamefixes-steam/1971650.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"""Octopath Traveler 2"""
2+
3+
from protonfixes import util
4+
5+
6+
def main() -> None:
7+
"""Imports demo saves into the full game's prefix"""
8+
9+
util.import_saves_folder(2203230, f'Documents/My Games/Octopath_Traveler2/Steam/{util.get_steam_account_id()}/SaveGames',True)

util.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,7 +1007,7 @@ def import_saves_folder(
10071007
# Looking for lines of the format
10081008
# \t\t"path"\t\t"(the path)"
10091009
if '"path"' in i:
1010-
paths.append(i[11:-1])
1010+
paths.append(i[11:-2])
10111011
except FileNotFoundError:
10121012
log.info("Could not find Steam's libraryfolders.vdf file.")
10131013
return False
@@ -1075,9 +1075,9 @@ def get_steam_account_id() -> str:
10751075
"""Returns your 17-digit Steam account ID"""
10761076
# The loginusers.vdf file contains information about accounts known to the Steam client, and contains their 17-digit IDs
10771077
with open(f'{os.environ["STEAM_BASE_FOLDER"]}/config/loginusers.vdf') as f:
1078-
lastFoundId = None
1078+
lastFoundId = "None"
10791079
for i in f.readlines():
1080-
if len(i) > 1 and i[2:-1].isdigit():
1081-
lastFoundId = i[2:-1]
1082-
elif i == f'\t\t"AccountName"\t\t"{os.environ["SteamUser"]}"':
1083-
return lastFoundId
1080+
if len(i) > 1 and i[2:-2].isdigit():
1081+
lastFoundId = i[2:-2]
1082+
elif i == (f'\t\t"AccountName"\t\t"{os.environ["SteamUser"]}"\n'):
1083+
return lastFoundId

0 commit comments

Comments
 (0)