This commit is contained in:
yumoqing 2022-09-23 12:14:11 +08:00
parent 452bf95dc0
commit 28260ceb5b

View File

@ -29,9 +29,9 @@ from .widget_css import register_css
from .version import __version__ from .version import __version__
if platform == 'android': if platform == 'android':
from android.storage import app_storage_path
from jnius import autoclass from jnius import autoclass
from .android_rotation import get_rotation
from .android_rotation import get_rotation
Logger.info(f'KivyBlocks:version={__version__}') Logger.info(f'KivyBlocks:version={__version__}')
def signal_handler(signal, frame): def signal_handler(signal, frame):
@ -106,14 +106,15 @@ class BlocksApp(App):
def get_user_data_path(self): def get_user_data_path(self):
if platform == 'android': if platform == 'android':
Environment = autoclass('android.os.Environment') # Environment = autoclass('android.os.Environment')
sdpath = Environment.getExternalStorageDirectory() # sdpath = Environment.getExternalStorageDirectory()
return str(sdpath) # return str(sdpath)
return str(app_storage_path())
sdpath = App.get_running_app().user_data_dir sdpath = App.get_running_app().user_data_dir
return str(sdpath) return str(sdpath)
def get_profile_name(self): 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) print('profile_path=', fname)
return fname return fname