Another attempt at fixing configuration paths.
This commit is contained in:
parent
48217dd63e
commit
f2326c628c
@ -47,17 +47,18 @@ class scoreboard():
|
|||||||
|
|
||||||
def write_config(writeGlobal = False):
|
def write_config(writeGlobal = False):
|
||||||
if writeGlobal == False:
|
if writeGlobal == False:
|
||||||
with open(gamePath, 'w') as configfile:
|
with open(gamePath + "config.ini", 'w') as configfile:
|
||||||
localConfig.write(configfile)
|
localConfig.write(configfile)
|
||||||
else:
|
else:
|
||||||
with open(globalPath, 'w') as configfile:
|
with open(globalPath + "config.ini", 'w') as configfile:
|
||||||
globalConfig.write(configfile)
|
globalConfig.write(configfile)
|
||||||
|
|
||||||
def read_config(section, value, readGlobal = False):
|
def read_config(section, value, readGlobal = False):
|
||||||
if readGlobal == False:
|
if readGlobal == False:
|
||||||
with open(gamePath, 'r') as configfile:
|
with open(gamePath + "config.ini", 'r') as configfile:
|
||||||
return localConfig.read(section, value)
|
return localConfig.read(section, value)
|
||||||
else:
|
else:
|
||||||
|
with open(globalPath + "config.ini", 'r') as configfile:
|
||||||
return globalConfig.read(section, value)
|
return globalConfig.read(section, value)
|
||||||
|
|
||||||
def speak(text, interupt = True):
|
def speak(text, interupt = True):
|
||||||
@ -80,8 +81,7 @@ def initialize_gui(gameTitle):
|
|||||||
global globalPath
|
global globalPath
|
||||||
global gamePath
|
global gamePath
|
||||||
globalPath = BaseDirectory.xdg_config_home + "/storm-games"
|
globalPath = BaseDirectory.xdg_config_home + "/storm-games"
|
||||||
gamePath = globalPath + "/" + str.lower(str.replace(gameTitle, " ", "-") + "/config")
|
gamePath = globalPath + "/" + str.lower(str.replace(gameTitle, " ", "-"))
|
||||||
globalPath = globalPath + "/config"
|
|
||||||
if not os.path.exists(gamePath): os.makedirs(gamePath)
|
if not os.path.exists(gamePath): os.makedirs(gamePath)
|
||||||
# Seed the random generator to the clock
|
# Seed the random generator to the clock
|
||||||
random.seed()
|
random.seed()
|
||||||
|
Loading…
Reference in New Issue
Block a user