forked from RatPoison-dev/RatInstaller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettingsTools.py
30 lines (27 loc) · 1.03 KB
/
settingsTools.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
import os, json
DEFAULT_SETTINGS = {'build_folder': 'build/',
'bypass_download': False,
'force_cheat_compile': False,
'force_cheat_update': False,
'force_install_jdk': False,
'github_repo': 'TheFuckingRat/RatPoison',
'jdk_link': 'https://download.jav...64_bin.zip',
'jdk_zip_name': 'JDK.zip',
'update_type': 'call_installer'
}
class Settings(object):
def __init__(self, dict):
self.dict = dict
def __getitem__(self, key):
return self.dict[key]
def __str__(self):
return str(self.__dict__)
@property
def repository_name(self):
return self.dict.get("github_repo").split("/")[1]
def loadSettings():
if (os.path.exists("installerSettings.json")):
with open("installerSettings.json") as settingsFile:
return Settings(json.load(settingsFile))
else:
return Settings(DEFAULT_SETTINGS)