Let us walk on the 3-isogeny graph
Loading...
Searching...
No Matches
pip._vendor.platformdirs.android Namespace Reference

Data Structures

class  Android
 

Functions

str|None _android_folder ()
 
str _android_documents_folder ()
 
str _android_downloads_folder ()
 
str _android_pictures_folder ()
 
str _android_videos_folder ()
 
str _android_music_folder ()
 

Detailed Description

Android.

Function Documentation

◆ _android_documents_folder()

str _android_documents_folder ( )
protected
:return: documents folder for the Android OS

Definition at line 129 of file android.py.

129def _android_documents_folder() -> str:
130 """:return: documents folder for the Android OS"""
131 # Get directories with pyjnius
132 try:
133 from jnius import autoclass
134
135 context = autoclass("android.content.Context")
136 environment = autoclass("android.os.Environment")
138 except Exception: # noqa: BLE001
139 documents_dir = "/storage/emulated/0/Documents"
140
141 return documents_dir
142
143
144@lru_cache(maxsize=1)
for i

References i.

Referenced by Android.user_documents_dir().

Here is the caller graph for this function:

◆ _android_downloads_folder()

str _android_downloads_folder ( )
protected
:return: downloads folder for the Android OS

Definition at line 145 of file android.py.

145def _android_downloads_folder() -> str:
146 """:return: downloads folder for the Android OS"""
147 # Get directories with pyjnius
148 try:
149 from jnius import autoclass
150
151 context = autoclass("android.content.Context")
152 environment = autoclass("android.os.Environment")
154 except Exception: # noqa: BLE001
155 downloads_dir = "/storage/emulated/0/Downloads"
156
157 return downloads_dir
158
159
160@lru_cache(maxsize=1)

References i.

Referenced by Android.user_downloads_dir().

Here is the caller graph for this function:

◆ _android_folder()

str | None _android_folder ( )
protected
:return: base folder for the Android OS or None if it cannot be found

Definition at line 108 of file android.py.

108def _android_folder() -> str | None:
109 """:return: base folder for the Android OS or None if it cannot be found"""
110 try:
111 # First try to get path to android app via pyjnius
112 from jnius import autoclass
113
114 context = autoclass("android.content.Context")
115 result: str | None = context.getFilesDir().getParentFile().getAbsolutePath()
116 except Exception: # noqa: BLE001
117 # if fails find an android folder looking path on the sys.path
118 pattern = re.compile(r"/data/(data|user/\d+)/(.+)/files")
119 for path in sys.path:
120 if pattern.match(path):
121 result = path.split("/files")[0]
122 break
123 else:
124 result = None
125 return result
126
127
128@lru_cache(maxsize=1)

References i.

Referenced by Android.user_cache_dir(), Android.user_config_dir(), and Android.user_data_dir().

Here is the caller graph for this function:

◆ _android_music_folder()

str _android_music_folder ( )
protected
:return: music folder for the Android OS

Definition at line 193 of file android.py.

193def _android_music_folder() -> str:
194 """:return: music folder for the Android OS"""
195 # Get directories with pyjnius
196 try:
197 from jnius import autoclass
198
199 context = autoclass("android.content.Context")
200 environment = autoclass("android.os.Environment")
202 except Exception: # noqa: BLE001
203 music_dir = "/storage/emulated/0/Music"
204
205 return music_dir
206
207

References i.

Referenced by Android.user_music_dir().

Here is the caller graph for this function:

◆ _android_pictures_folder()

str _android_pictures_folder ( )
protected
:return: pictures folder for the Android OS

Definition at line 161 of file android.py.

161def _android_pictures_folder() -> str:
162 """:return: pictures folder for the Android OS"""
163 # Get directories with pyjnius
164 try:
165 from jnius import autoclass
166
167 context = autoclass("android.content.Context")
168 environment = autoclass("android.os.Environment")
170 except Exception: # noqa: BLE001
171 pictures_dir = "/storage/emulated/0/Pictures"
172
173 return pictures_dir
174
175
176@lru_cache(maxsize=1)

References i.

Referenced by Android.user_pictures_dir().

Here is the caller graph for this function:

◆ _android_videos_folder()

str _android_videos_folder ( )
protected
:return: videos folder for the Android OS

Definition at line 177 of file android.py.

177def _android_videos_folder() -> str:
178 """:return: videos folder for the Android OS"""
179 # Get directories with pyjnius
180 try:
181 from jnius import autoclass
182
183 context = autoclass("android.content.Context")
184 environment = autoclass("android.os.Environment")
186 except Exception: # noqa: BLE001
187 videos_dir = "/storage/emulated/0/DCIM/Camera"
188
189 return videos_dir
190
191
192@lru_cache(maxsize=1)

References i.

Referenced by Android.user_videos_dir().

Here is the caller graph for this function: