fix debug
This commit is contained in:
parent
6634df1999
commit
e8a0a63c38
@ -28,9 +28,11 @@ class debugManager():
|
||||
directory = os.path.dirname(self._fileName)
|
||||
if not os.path.exists(directory):
|
||||
pathlib.Path(directory).mkdir(parents=True, exist_ok=True)
|
||||
try:
|
||||
self._file = open(self._fileName,'a')
|
||||
self._fileOpened = True
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
def writeDebugOut(self, text, level = debug.debugLevel.DEACTIVE, onAnyLevel=False):
|
||||
|
||||
mode = self.env['runtime']['settingsManager'].getSetting('general','debugMode')
|
||||
@ -57,13 +59,18 @@ class debugManager():
|
||||
if printMode:
|
||||
print(msg)
|
||||
if fileMode:
|
||||
try:
|
||||
self._file.write(msg + '\n')
|
||||
|
||||
except Exception as e:
|
||||
print(e)
|
||||
def closeDebugFile(self):
|
||||
if not self._fileOpened:
|
||||
return False
|
||||
if self._file != None:
|
||||
try:
|
||||
self._file.close()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
self._fileOpened = False
|
||||
return True
|
||||
|
||||
|
@ -286,9 +286,6 @@ class settingsManager():
|
||||
if not validConfig:
|
||||
return None
|
||||
|
||||
environment['runtime']['debug'] = debugManager.debugManager(self.env['runtime']['settingsManager'].getSetting('general','debugFile'))
|
||||
environment['runtime']['debug'].initialize(environment)
|
||||
|
||||
if cliArgs.options != '':
|
||||
self.parseSettingArgs(cliArgs.options)
|
||||
if cliArgs.debug:
|
||||
@ -299,6 +296,9 @@ class settingsManager():
|
||||
self.setFenrirKeys(self.getSetting('general','fenrirKeys'))
|
||||
self.setScriptKeys(self.getSetting('general','scriptKeys'))
|
||||
|
||||
environment['runtime']['debug'] = debugManager.debugManager(self.env['runtime']['settingsManager'].getSetting('general','debugFile'))
|
||||
environment['runtime']['debug'].initialize(environment)
|
||||
|
||||
if not os.path.exists(self.getSetting('keyboard','keyboardLayout')):
|
||||
if os.path.exists(settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout')):
|
||||
self.setSetting('keyboard', 'keyboardLayout', settingsRoot + 'keyboard/' + self.getSetting('keyboard','keyboardLayout'))
|
||||
|
Loading…
Reference in New Issue
Block a user