From a8772f769964f27871a968d9bd1010f504e50265 Mon Sep 17 00:00:00 2001 From: chrys87 Date: Thu, 23 Feb 2017 15:27:13 +0100 Subject: [PATCH] Update commandManager.py --- src/fenrir/core/commandManager.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/fenrir/core/commandManager.py b/src/fenrir/core/commandManager.py index a844f667..6d3a0814 100644 --- a/src/fenrir/core/commandManager.py +++ b/src/fenrir/core/commandManager.py @@ -46,7 +46,16 @@ class commandManager(): commandPath = os.path.dirname(os.path.realpath(__main__.__file__)) if not commandPath.endswith('/'): 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+'*') for command in commandList: try: @@ -71,7 +80,7 @@ class commandManager(): scriptPath = self.env['runtime']['settingsManager'].getSetting('general', 'scriptPath') if not scriptPath.endswith('/'): 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/'): scriptPath = os.path.dirname(os.path.realpath(__main__.__file__)) +'/../../config/scripts/' else: