Skip to content

Commit

Permalink
Don't write config during initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
Systemcluster committed Sep 14, 2020
1 parent f1d0353 commit 076d2db
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/configuration/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def __init__(self, documentsPath: str = '', gamePath: str = '', configPath: str
if not path.exists(self.__userSettingsPath):
os.mkdir(self.__userSettingsPath)

self.set('PATHS', 'documents', self.documents)
self.set('PATHS', 'documents', self.documents, False)

self.readPriority()

Expand All @@ -74,7 +74,7 @@ def __init__(self, documentsPath: str = '', gamePath: str = '', configPath: str
self.game = gamePath

if not self.get('PATHS', 'scriptmerger'):
self.set('PATHS', 'scriptmerger', '')
self.set('PATHS', 'scriptmerger', '', False)
if not self.allowpopups:
self.allowpopups = '1'
if not self.language:
Expand Down Expand Up @@ -124,11 +124,12 @@ def get(self, section: str, option: str):
return self.config.get(section, option)
return None

def set(self, section: str, option: str, value):
def set(self, section: str, option: str, value, write: bool = True):
if not self.config.has_section(section):
self.config.add_section(section)
self.config.set(section, option, value)
self.write()
if write:
self.write()

def getPriority(self, section: str):
if self.priority.has_section(section):
Expand Down

0 comments on commit 076d2db

Please sign in to comment.