HEX
Server: LiteSpeed
System: Linux s787.bom1.mysecurecloudhost.com 4.18.0-477.13.1.lve.el8.x86_64 #1 SMP Thu Jun 1 16:40:47 EDT 2023 x86_64
User: mobilech (5348)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/platformdirs/__pycache__/android.cpython-310.pyc
o

;j5#�@s�dZddlmZddlZddlZddlZddlmZddlm	Z	m
Z
ddlmZGdd	�d	e�Z
edd
�dd
d��Zedd
�ddd��Zedd
�ddd��Zedd
�ddd��Zedd
�ddd��Zedd
�ddd��Zd	gZdS)zAndroid.�)�annotationsN)�	lru_cache)�
TYPE_CHECKING�cast�)�PlatformDirsABCc@s�eZdZdZed%dd��Zed%dd��Zed%dd	��Zed%d
d��Zed%dd
��Z	ed%dd��Z
ed%dd��Zed%dd��Zed%dd��Z
ed%dd��Zed%dd��Zed%dd��Zed%dd��Zed%dd��Zed%d d!��Zed%d"d#��Zd$S)&�Androida"
    Follows the guidance `from here <https://android.stackexchange.com/a/216132>`_.

    Makes use of the `appname <platformdirs.api.PlatformDirsABC.appname>`, `version
    <platformdirs.api.PlatformDirsABC.version>`, `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.

    �return�strcC�|�tdt��d�S)zd:return: data directory tied to the user, e.g. ``/data/user/<userid>/<packagename>/files/<AppName>``r
�files�Z_append_app_name_and_versionr�_android_folder��self�r�H/opt/saltstack/salt/lib/python3.10/site-packages/platformdirs/android.py�
user_data_dir�zAndroid.user_data_dircC�|jS)z@:return: data directory shared by users, same as `user_data_dir`�rrrrr�
site_data_dir�zAndroid.site_data_dircCr)z�
        :return: config directory tied to the user, e.g.         ``/data/user/<userid>/<packagename>/shared_prefs/<AppName>``
        r
Zshared_prefsr
rrrr�user_config_dir!szAndroid.user_config_dircCr)zH:return: config directory shared by the users, same as `user_config_dir`)rrrrr�site_config_dir)rzAndroid.site_config_dircCr)ze:return: cache directory tied to the user, e.g.,``/data/user/<userid>/<packagename>/cache/<AppName>``r
�cacher
rrrr�user_cache_dir.rzAndroid.user_cache_dircCr)zB:return: cache directory shared by users, same as `user_cache_dir`)rrrrr�site_cache_dir3rzAndroid.site_cache_dircCr)zB:return: state directory tied to the user, same as `user_data_dir`rrrrr�user_state_dir8rzAndroid.user_state_dircC�|j}|jr
tj�|d�}|S)z�
        :return: log directory tied to the user, same as `user_cache_dir` if not opinionated else ``log`` in it,
          e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>/log``
        �log�rZopinion�os�path�join�rr#rrr�user_log_dir=�zAndroid.user_log_dircC�t�S)zT:return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents``)�_android_documents_folderrrrr�user_documents_dirHrzAndroid.user_documents_dircCr()zT:return: downloads directory tied to the user e.g. ``/storage/emulated/0/Downloads``)�_android_downloads_folderrrrr�user_downloads_dirMrzAndroid.user_downloads_dircCr()zR:return: pictures directory tied to the user e.g. ``/storage/emulated/0/Pictures``)�_android_pictures_folderrrrr�user_pictures_dirRrzAndroid.user_pictures_dircCr()zS:return: videos directory tied to the user e.g. ``/storage/emulated/0/DCIM/Camera``)�_android_videos_folderrrrr�user_videos_dirWrzAndroid.user_videos_dircCr()zL:return: music directory tied to the user e.g. ``/storage/emulated/0/Music``)�_android_music_folderrrrr�user_music_dir\rzAndroid.user_music_dircCsdS)zP:return: desktop directory tied to the user e.g. ``/storage/emulated/0/Desktop``z/storage/emulated/0/Desktoprrrrr�user_desktop_diraszAndroid.user_desktop_dircCr)z�
        :return: runtime directory tied to the user, same as `user_cache_dir` if not opinionated else ``tmp`` in it,
          e.g. ``/data/user/<userid>/<packagename>/cache/<AppName>/tmp``
        �tmpr!r%rrr�user_runtime_dirfr'zAndroid.user_runtime_dircCr)zF:return: runtime directory shared by users, same as `user_runtime_dir`)r5rrrr�site_runtime_dirqrzAndroid.site_runtime_dirN�r	r
)�__name__�
__module__�__qualname__�__doc__�propertyrrrrrrrr&r*r,r.r0r2r3r5r6rrrrrsD

r)�maxsizer	�
str | NonecCsd}ts'zddlm}td|���}|������}Wnty&d}Ynw|durKzddl	m
}|d�}|������}WntyJd}Ynw|durjt�d�}t
jD]}|�|�rg|�d�d}nqWd}|dur�t�d�}t
jD]}|�|�r�|�d�d}|Sqvd}|S)	zE:return: base folder for the Android OS or None if it cannot be foundNr)�	mActivity�android.content.Context��	autoclassz /data/(data|user/\d+)/(.+)/filesz/filesz7/mnt/expand/[a-fA-F0-9-]{36}/(data|user/\d+)/(.+)/files)rZandroidr?rZgetApplicationContextZgetFilesDirZ
getParentFile�getAbsolutePath�	Exception�jniusrB�re�compile�sysr#�match�split)�resultr?�contextrB�patternr#rrrrwsF��


�


�rr
cC�Lzddlm}|d�}|d�}|�|j���}W|Sty%d}Y|Sw)z,:return: documents folder for the Android OSrrAr@�android.os.Environmentz/storage/emulated/0/Documents)rErB�getExternalFilesDirZDIRECTORY_DOCUMENTSrCrD)rBrL�environmentZ
documents_dirrrrr)����r)cCrN)z,:return: downloads folder for the Android OSrrAr@rOz/storage/emulated/0/Downloads)rErBrPZDIRECTORY_DOWNLOADSrCrD)rBrLrQZ
downloads_dirrrrr+�rRr+cCrN)z+:return: pictures folder for the Android OSrrAr@rOz/storage/emulated/0/Pictures)rErBrPZDIRECTORY_PICTURESrCrD)rBrLrQZpictures_dirrrrr-�rRr-cCrN)z):return: videos folder for the Android OSrrAr@rOz/storage/emulated/0/DCIM/Camera)rErBrPZDIRECTORY_DCIMrCrD)rBrLrQZ
videos_dirrrrr/�rRr/cCrN)z(:return: music folder for the Android OSrrAr@rOz/storage/emulated/0/Music)rErBrPZDIRECTORY_MUSICrCrD)rBrLrQZ	music_dirrrrr1�rRr1)r	r>r7)r;�
__future__rr"rFrH�	functoolsr�typingrrZapirrrr)r+r-r/r1�__all__rrrr�<module>s.i/�