Another attempt at fixing configuration paths.

This commit is contained in:
Storm Dragon 2019-12-10 18:36:29 -05:00
parent 48217dd63e
commit f2326c628c

View File

@ -47,17 +47,18 @@ class scoreboard():
def write_config(writeGlobal = False):
if writeGlobal == False:
with open(gamePath, 'w') as configfile:
with open(gamePath + "config.ini", 'w') as configfile:
localConfig.write(configfile)
else:
with open(globalPath, 'w') as configfile:
with open(globalPath + "config.ini", 'w') as configfile:
globalConfig.write(configfile)
def read_config(section, value, readGlobal = False):
if readGlobal == False:
with open(gamePath, 'r') as configfile:
with open(gamePath + "config.ini", 'r') as configfile:
return localConfig.read(section, value)
else:
with open(globalPath + "config.ini", 'r') as configfile:
return globalConfig.read(section, value)
def speak(text, interupt = True):
@ -80,8 +81,7 @@ def initialize_gui(gameTitle):
global globalPath
global gamePath
globalPath = BaseDirectory.xdg_config_home + "/storm-games"
gamePath = globalPath + "/" + str.lower(str.replace(gameTitle, " ", "-") + "/config")
globalPath = globalPath + "/config"
gamePath = globalPath + "/" + str.lower(str.replace(gameTitle, " ", "-"))
if not os.path.exists(gamePath): os.makedirs(gamePath)
# Seed the random generator to the clock
random.seed()