Update commandManager.py

This commit is contained in:
chrys87 2017-02-23 15:27:13 +01:00 committed by GitHub
parent fc6a338164
commit a8772f7699

View File

@ -46,7 +46,16 @@ class commandManager():
commandPath = os.path.dirname(os.path.realpath(__main__.__file__)) commandPath = os.path.dirname(os.path.realpath(__main__.__file__))
if not commandPath.endswith('/'): if not commandPath.endswith('/'):
commandPath += '/' commandPath += '/'
commandFolder = commandPath + "/commands/" + section +"/" commandFolder = commandPath + "commands/" + section +"/"
if not os.path.exists(commandFolder):
self.env['runtime']['debug'].writeDebugOut("commandFolder not exists:" + commandFolder ,debug.debugLevel.ERROR)
return
if not os.path.isdir(commandFolder):
self.env['runtime']['debug'].writeDebugOut("commandFolder not a directory:" + commandFolder ,debug.debugLevel.ERROR)
return
if not os.access(commandFolder, os.R_OK):
self.env['runtime']['debug'].writeDebugOut("commandFolder not readable:" + commandFolder ,debug.debugLevel.ERROR)
return
commandList = glob.glob(commandFolder+'*') commandList = glob.glob(commandFolder+'*')
for command in commandList: for command in commandList:
try: try:
@ -71,7 +80,7 @@ class commandManager():
scriptPath = self.env['runtime']['settingsManager'].getSetting('general', 'scriptPath') scriptPath = self.env['runtime']['settingsManager'].getSetting('general', 'scriptPath')
if not scriptPath.endswith('/'): if not scriptPath.endswith('/'):
scriptPath += '/' scriptPath += '/'
if not os.path.exists(scriptPath) or scriptPath == '/': if not os.path.exists(scriptPath):
if os.path.exists(os.path.dirname(os.path.realpath(__main__.__file__)) +'/../../config/scripts/'): 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/' scriptPath = os.path.dirname(os.path.realpath(__main__.__file__)) +'/../../config/scripts/'
else: else: