From e1fb3f7d929d5032bc046ce440d5fcf7efac6006 Mon Sep 17 00:00:00 2001 From: ! Freaku <92618708+Freaku17@users.noreply.github.com> Date: Sun, 5 Mar 2023 10:00:49 +0530 Subject: [PATCH] Update Terminal.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Implements workaround method of `create_sys` folder for all devices. (Earlier I made that only for Android 13, but recently faced the same error but on Android 12. So it isn't dependent on Android version) --- Utilities/Terminal.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Utilities/Terminal.py b/Utilities/Terminal.py index 2637cc0..fd057cb 100644 --- a/Utilities/Terminal.py +++ b/Utilities/Terminal.py @@ -72,7 +72,7 @@ # ba_meta require api 7 -import _ba, ba, os, re +import _ba, ba, os from efro.log import LogLevel folder = _ba.env()['python_directory_user'] + "/console/" log_post = folder + 'logs.txt' @@ -103,11 +103,10 @@ def write_logs(log): def make_sys(): path = _ba.app.python_directory_user +'/sys/'+_ba.app.version if not os.path.exists(path): - if (_ba.app.platform == 'android') and (int(re.search(r"android (\d+)", _ba.env()["user_agent_string"]).group(1)) if re.search(r"android (\d+)", _ba.env()["user_agent_string"]) else 1) >= 13: - make_sys_for_android_13(path) - else: - import ba.modutils as utils - utils.create_user_system_scripts() + # Old method: + # import ba.modutils as utils + # utils.create_user_system_scripts() + make_sys_wordaround(path) if _ba.app.platform == 'android': if path.find('/0/'): path = path.split('/0/')[1] @@ -118,7 +117,7 @@ def make_sys(): else: ba.screenmessage('Cannot run '+__name__+'.create_sys\nScripts already exist :/',color=(1,0,0)) -def make_sys_for_android_13(path): +def make_sys_wordaround(path): # With continued increasing restrictions of Android, # it is not possible to "view" in-game folders copied to an external path. # Luckily we are still able to write files.