o 7]h@s~ddlmZddlZddlZddlZddlmZddlmZGdddeZ edddd d Z edddd dZ dgZ dS)) annotationsN) lru_cache)PlatformDirsABCc@seZdZdZedddZedddZeddd Zedd d Zedd d Z edddZ edddZ edddZ edddZ dS)Androidz Follows the guidance `from here `_. Makes use of the `appname ` and `version `. returnstrcC|tdS)zd:return: data directory tied to the user, e.g. ``/data/user///files/``files_append_app_name_and_version_android_folderselfrB/usr/lib/python3/dist-packages/pip/_vendor/platformdirs/android.py user_data_dirzAndroid.user_data_dircC|jS)z@:return: data directory shared by users, same as `user_data_dir`rrrrr site_data_dirzAndroid.site_data_dircCr )z :return: config directory tied to the user, e.g. ``/data/user///shared_prefs/`` shared_prefsr rrrruser_config_dirszAndroid.user_config_dircCr)zH:return: config directory shared by the users, same as `user_config_dir`)rrrrrsite_config_dir#rzAndroid.site_config_dircCr )zj:return: cache directory tied to the user, e.g. e.g. ``/data/user///cache/``cacher rrrruser_cache_dir(rzAndroid.user_cache_dircCr)zB:return: state directory tied to the user, same as `user_data_dir`rrrrruser_state_dir-rzAndroid.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///cache//log`` logropinionospathjoinrr#rrr user_log_dir2zAndroid.user_log_dircCstS)zf :return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents`` )_android_documents_folderrrrruser_documents_dir=szAndroid.user_documents_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///cache//tmp`` tmpr r%rrruser_runtime_dirDr'zAndroid.user_runtime_dirNrr)__name__ __module__ __qualname____doc__propertyrrrrrrr&r)r+rrrrr s(        r)maxsizerrcCsxzddlm}|d}|}W|Sty;td}tj D]}| |r6| dd}Y|Sq$t dw)z':return: base folder for the Android OSr autoclassandroid.content.Contextz /data/(data|user/\d+)/(.+)/filesz/filesz&Cannot find path to android app folder) jniusr4 getFilesDir getParentFilegetAbsolutePath Exceptionrecompilesysr#matchsplitOSError)r4Contextresultpatternr#rrrr Ps    r cCsLzddlm}|d}|d}||j}W|Sty%d}Y|Sw)z,:return: documents folder for the Android OSrr3r5zandroid.os.Environmentz/storage/emulated/0/Documents)r6r4getExternalFilesDirDIRECTORY_DOCUMENTSr9r:)r4rA Environment documents_dirrrrr(es  r(r,) __future__rr"r;r= functoolsrapirrr r(__all__rrrrs   E