2from __future__
import annotations
7from functools
import lru_cache
10from .api
import PlatformDirsABC
15 Follows the guidance `from here <https://android.stackexchange.com/a/216132>`_. Makes use of the
16 `appname <platformdirs.api.PlatformDirsABC.appname>`,
17 `version <platformdirs.api.PlatformDirsABC.version>`,
18 `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
23 """:return: data directory tied to the user, e.g. ``/data/user/<userid>/<packagename>/files/<AppName>``"""
28 """:return: data directory shared by users, same as `user_data_dir`"""
34 :return: config directory tied to the user, e.g. \
35 ``/data/user/<userid>/<packagename>/shared_prefs/<AppName>``
41 """:return: config directory shared by the users, same as `user_config_dir`"""
46 """:return: cache directory tied to the user, e.g. e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>``"""
51 """:return: cache directory shared by users, same as `user_cache_dir`"""
56 """:return: state directory tied to the user, same as `user_data_dir`"""
62 :return: log directory tied to the user, same as `user_cache_dir` if not opinionated else ``log`` in it,
63 e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>/log``
72 """:return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents``"""
77 """:return: downloads directory tied to the user e.g. ``/storage/emulated/0/Downloads``"""
82 """:return: pictures directory tied to the user e.g. ``/storage/emulated/0/Pictures``"""
87 """:return: videos directory tied to the user e.g. ``/storage/emulated/0/DCIM/Camera``"""
92 """:return: music directory tied to the user e.g. ``/storage/emulated/0/Music``"""
98 :return: runtime directory tied to the user, same as `user_cache_dir` if not opinionated else ``tmp`` in it,
99 e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>/tmp``
109 """:return: base folder for the Android OS or None if it cannot be found"""
112 from jnius
import autoclass
114 context =
autoclass(
"android.content.Context")
118 pattern =
re.compile(
r"/data/(data|user/\d+)/(.+)/files")
130 """:return: documents folder for the Android OS"""
133 from jnius
import autoclass
135 context =
autoclass(
"android.content.Context")
136 environment =
autoclass(
"android.os.Environment")
139 documents_dir =
"/storage/emulated/0/Documents"
146 """:return: downloads folder for the Android OS"""
149 from jnius
import autoclass
151 context =
autoclass(
"android.content.Context")
152 environment =
autoclass(
"android.os.Environment")
155 downloads_dir =
"/storage/emulated/0/Downloads"
162 """:return: pictures folder for the Android OS"""
165 from jnius
import autoclass
167 context =
autoclass(
"android.content.Context")
168 environment =
autoclass(
"android.os.Environment")
171 pictures_dir =
"/storage/emulated/0/Pictures"
178 """:return: videos folder for the Android OS"""
181 from jnius
import autoclass
183 context =
autoclass(
"android.content.Context")
184 environment =
autoclass(
"android.os.Environment")
187 videos_dir =
"/storage/emulated/0/DCIM/Camera"
194 """:return: music folder for the Android OS"""
197 from jnius
import autoclass
199 context =
autoclass(
"android.content.Context")
200 environment =
autoclass(
"android.os.Environment")
203 music_dir =
"/storage/emulated/0/Music"