From 0cc0f165f598deb363eb14e61f9c28cc60ce18ab Mon Sep 17 00:00:00 2001 From: midoks Date: Mon, 1 Aug 2022 20:31:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=B0=83=E8=AF=95=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- class/core/mw.py | 11 +++++++++++ class/core/plugins_api.py | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/class/core/mw.py b/class/core/mw.py index 15f4c1018..ff8ab8a5a 100755 --- a/class/core/mw.py +++ b/class/core/mw.py @@ -111,6 +111,17 @@ def isAppleSystem(): return False +def isDebugMode(): + if isAppleSystem(): + return True + + debugPath = getRunDir() + "/data/debug.pl" + if os.path.exists(debugPath): + return True + + return False + + def isNumber(s): try: float(s) diff --git a/class/core/plugins_api.py b/class/core/plugins_api.py index d989ff5ff..f144fdfc9 100755 --- a/class/core/plugins_api.py +++ b/class/core/plugins_api.py @@ -845,7 +845,7 @@ class plugins_api: return ('', '') data = mw.execShell(py_cmd) - if mw.isAppleSystem(): + if mw.isDebugMode(): print('run', py_cmd) print(data) # print os.path.exists(py_cmd) @@ -861,7 +861,7 @@ class plugins_api: sys.path.append(package) eval_str = "__import__('" + script + "')." + func + '(' + args + ')' newRet = eval(eval_str) - if mw.isAppleSystem(): + if mw.isDebugMode(): print('callback', eval_str) return (True, newRet)