-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmodcfg.py
33 lines (22 loc) · 900 Bytes
/
modcfg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import vdf
import sys
import os
from pathlib import Path
print("Setting new launch options")
steam_path = os.path.expanduser("~/.steam/steam")
if(len(sys.argv) > 1):
steam_path = sys.argv[1]
userdata = Path(steam_path, "userdata")
# Get first account id
# TODO: Give user the choice to choose accounts
userid = next(os.scandir(userdata)).path
config_path = Path(userid, "config/localconfig.vdf")
with open(config_path, 'r') as config_file:
config = vdf.load(config_file)
rl_config = config["UserLocalConfigStore"]["Software"]["Valve"]["Steam"]["apps"]["252950"]
if "LaunchOptions" in rl_config:
print(f"Previous launch options: {rl_config['LaunchOptions']}")
rl_config["LaunchOptions"] = f"\"{str(Path(os.path.dirname(__file__), 'bakkes.sh'))}\" & %command%"
with open(config_path, 'w') as config_file:
vdf.dump(config, config_file, pretty=True)
print("Launch options set")