fallback for script folder to config/scripts, remove debug code that runs any script on startup lol

This commit is contained in:
chrys 2016-10-19 20:58:56 +02:00
parent 11c940a114
commit e52f8fe685

View File

@ -54,8 +54,13 @@ class commandManager():
def loadScriptCommands(self, section='commands'):
scriptPath = self.env['runtime']['settingsManager'].getSetting('general', 'scriptPath')
if not os.path.exists(scriptPath):
self.env['runtime']['debug'].writeDebugOut("scriptpath not exists:" + scriptPath ,debug.debugLevel.ERROR)
if not scriptPath.endswith('/'):
scriptPath += '/'
if not os.path.exists(scriptPath) or scriptPath == '/':
if os.path.exists(os.path.dirname(os.path.realpath(__main__.__file__)) +'/../../config/scripts/'):
scriptPath = os.path.dirname(os.path.realpath(__main__.__file__)) +'/../../config/scripts/'
else:
self.env['runtime']['debug'].writeDebugOut("scriptpath not exists:" + scriptPath ,debug.debugLevel.WARNING)
return
if not os.path.isdir(scriptPath):
self.env['runtime']['debug'].writeDebugOut("scriptpath not a directory:" + scriptPath ,debug.debugLevel.ERROR)
@ -63,7 +68,7 @@ class commandManager():
if not os.access(scriptPath, os.R_OK):
self.env['runtime']['debug'].writeDebugOut("scriptpath not readable:" + scriptPath ,debug.debugLevel.ERROR)
return
commandList = glob.glob(self.env['runtime']['settingsManager'].getSetting('general', 'scriptPath')+'/*')
commandList = glob.glob(scriptPath+'*')
subCommand = os.path.dirname(os.path.realpath(__main__.__file__)) + '/commands/commands/subprocess.py'
for command in commandList:
invalid = False
@ -77,7 +82,6 @@ class commandManager():
spec.loader.exec_module(command_mod)
self.env['commands'][section][fileName.upper()] = command_mod.command()
self.env['commands'][section][fileName.upper()].initialize(self.env,command)
self.env['commands'][section][fileName.upper()].run()
self.env['runtime']['debug'].writeDebugOut("Load script:" + section + "." + fileName.upper() ,debug.debugLevel.INFO, onAnyLevel=True)
commSettings = fileName.upper().split('__-__')
if len(commSettings) == 1: