Dev 140320221219
Moved logic to multiple files, changed file system
This commit is contained in:
32
resources/lib/config.py
Normal file
32
resources/lib/config.py
Normal file
@@ -0,0 +1,32 @@
|
||||
import os
|
||||
import json
|
||||
|
||||
configfile = "resources/cfg.cfg"
|
||||
|
||||
if not os.path.isfile(configfile):
|
||||
cfgwrite = open(configfile, 'w+')
|
||||
empty = {}
|
||||
json.dump(empty, cfgwrite, indent=3)
|
||||
cfgwrite.close()
|
||||
|
||||
with open(configfile) as cfgread:
|
||||
config = json.load(cfgread)
|
||||
|
||||
try:
|
||||
config['mainbuild']
|
||||
except:
|
||||
if "MultiMate_Player.py" in os.listdir(os.getcwd()):
|
||||
config['mainbuild'] = 'MultiMate_Player.py'
|
||||
elif "MultiMate_Player.pyw" in os.listdir(os.getcwd()):
|
||||
config['mainbuild'] = 'MultiMate_Player.pyw'
|
||||
elif "MultiMate_Player.exe" in os.listdir(os.getcwd()):
|
||||
config['mainbuild'] = 'MultiMate_Player.exe'
|
||||
with open(configfile, 'w+') as cfgwrite:
|
||||
json.dump(config, cfgwrite, indent=3)
|
||||
|
||||
try:
|
||||
config['showrpc']
|
||||
except:
|
||||
config['showrpc'] = True
|
||||
with open(configfile, 'w+') as cfgwrite:
|
||||
json.dump(config, cfgwrite, indent=3)
|
||||
Reference in New Issue
Block a user