-
Notifications
You must be signed in to change notification settings - Fork 0
/
config_reader.py
43 lines (33 loc) · 1.05 KB
/
config_reader.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
34
35
36
37
38
39
40
41
42
43
import json
import os
import initialise
class config_reader:
def read_config(self, file_name):
try:
initialise
with open(file_name, 'r') as file:
config = json.load(file)
self.steam_path = config["path"]
self.rules = config["rules"]
return True
except:
return False
def read(self):
xdg = False
root = os.getenv("XDG_CONFIG_HOME")
if root != None:
xdg = True
if xdg:
config_path = root + "/steam_launch_options_manager.config"
status = self.read_config(config_path)
if status:
return
root = os.getenv("HOME") + "/.config"
config_path = root + "/steam_launch_options_manager.config"
status = self.read_config(config_path)
if status:
return
print(
"No config for steam launch options manager found. Starting initialization. \n")
initialise.initialise().initialise()
config_reader().read()