From 28260ceb5b23afe656a45620d8fe02bc26bbcf7c Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 23 Sep 2022 12:14:11 +0800 Subject: [PATCH] bugfix --- kivyblocks/blocksapp.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/kivyblocks/blocksapp.py b/kivyblocks/blocksapp.py index 8e0e445..2353a23 100644 --- a/kivyblocks/blocksapp.py +++ b/kivyblocks/blocksapp.py @@ -29,9 +29,9 @@ from .widget_css import register_css from .version import __version__ if platform == 'android': + from android.storage import app_storage_path from jnius import autoclass - -from .android_rotation import get_rotation + from .android_rotation import get_rotation Logger.info(f'KivyBlocks:version={__version__}') def signal_handler(signal, frame): @@ -106,14 +106,15 @@ class BlocksApp(App): def get_user_data_path(self): if platform == 'android': - Environment = autoclass('android.os.Environment') - sdpath = Environment.getExternalStorageDirectory() - return str(sdpath) + # Environment = autoclass('android.os.Environment') + # sdpath = Environment.getExternalStorageDirectory() + # return str(sdpath) + return str(app_storage_path()) sdpath = App.get_running_app().user_data_dir return str(sdpath) def get_profile_name(self): - fname = os.path.join(self.user_data_dir,'.profile.json') + fname = os.path.join(self.get_user_data_path(),'.profile.json') print('profile_path=', fname) return fname