Update commandManager.py

This commit is contained in:
chrys87 2017-07-25 14:53:37 +02:00 committed by GitHub
parent 60cb324a10
commit ff64be3459

View File

@ -4,8 +4,9 @@
# Fenrir TTY screen reader # Fenrir TTY screen reader
# By Chrys, Storm Dragon, and contributers. # By Chrys, Storm Dragon, and contributers.
import glob, os, time import glob, os, time, inspect
from . import fenrirVersion currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
fenrirPath = os.path.dirname(currentdir)
from core import debug from core import debug
from utils import module_utils from utils import module_utils
@ -32,7 +33,7 @@ class commandManager():
def loadCommands(self, section='commands',commandPath=''): def loadCommands(self, section='commands',commandPath=''):
if commandPath =='': if commandPath =='':
commandPath = os.path.dirname(os.path.realpath(fenrirVersion.__file__))+ "/commands/" commandPath = fenrirPath+ "/commands/"
if not commandPath.endswith('/'): if not commandPath.endswith('/'):
commandPath += '/' commandPath += '/'
commandFolder = commandPath + section +"/" commandFolder = commandPath + section +"/"
@ -76,8 +77,8 @@ class commandManager():
if not scriptPath.endswith('/'): if not scriptPath.endswith('/'):
scriptPath += '/' scriptPath += '/'
if not os.path.exists(scriptPath): if not os.path.exists(scriptPath):
if os.path.exists(os.path.dirname(os.path.realpath(fenrirVersion.__file__)) +'/../../config/scripts/'): if os.path.exists(fenrirPath) +'/../../config/scripts/'):
scriptPath = os.path.dirname(os.path.realpath(fenrirVersion.__file__)) +'/../../config/scripts/' scriptPath = fenrirPath +'/../../config/scripts/'
else: else:
self.env['runtime']['debug'].writeDebugOut("scriptpath not exists:" + scriptPath ,debug.debugLevel.WARNING) self.env['runtime']['debug'].writeDebugOut("scriptpath not exists:" + scriptPath ,debug.debugLevel.WARNING)
return return