a [f@szddlZddlZddlZddlmZddlmZGdddeZeddedd d Z eddedd d Z dgZ dS) N) lru_cache)PlatformDirsABCc@seZdZdZeedddZeedddZeedddZeedd d Z eedd d Z eedd dZ eedddZ eedddZ eedddZdS)Androidz Follows the guidance `from here `_. Makes use of the `appname ` and `version `. returncCs|tdS)zd:return: data directory tied to the user, e.g. ``/data/user///files/``filesZ_append_app_name_and_version_android_folderselfr D/usr/lib/python3.9/site-packages/pip/_vendor/platformdirs/android.py user_data_dirszAndroid.user_data_dircCs|jS)z@:return: data directory shared by users, same as `user_data_dir`rr r r r site_data_dirszAndroid.site_data_dircCs|tdS)z :return: config directory tied to the user, e.g. ``/data/user///shared_prefs/`` Z shared_prefsr r r r ruser_config_dirszAndroid.user_config_dircCs|jS)zH:return: config directory shared by the users, same as `user_config_dir`)rr r r rsite_config_dir!szAndroid.site_config_dircCs|tdS)zj:return: cache directory tied to the user, e.g. e.g. ``/data/user///cache/``cacher r r r ruser_cache_dir&szAndroid.user_cache_dircCs|jS)zB:return: state directory tied to the user, same as `user_data_dir`rr r r ruser_state_dir+szAndroid.user_state_dircCs|j}|jrtj|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`` logrZopinionospathjoinr rr r r user_log_dir0szAndroid.user_log_dircCstS)zf :return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents`` )_android_documents_folderr r r ruser_documents_dir;szAndroid.user_documents_dircCs|j}|jrtj|d}|S)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`` tmprrr r ruser_runtime_dirBszAndroid.user_runtime_dirN)__name__ __module__ __qualname____doc__propertystrrrrrrrrrr!r r r rr s& r)maxsizercCszz(ddlm}|d}|}WnLtyttd}tj D] }| |rF| dd}qpqFt dYn0|S)z':return: base folder for the Android OSr autoclassandroid.content.Contextz /data/(data|user/\d+)/(.+)/filesz/filesz&Cannot find path to android app folder) jniusr*Z getFilesDirZ getParentFilegetAbsolutePath ExceptionrecompilesysrmatchsplitOSError)r*Contextresultpatternrr r rr Ns     r cCsLz0ddlm}|d}|d}||j}WntyFd}Yn0|S)z,:return: documents folder for the Android OSrr)r+zandroid.os.Environmentz/storage/emulated/0/Documents)r,r*ZgetExternalFilesDirZDIRECTORY_DOCUMENTSr-r.)r*r5Z EnvironmentZ documents_dirr r rrcs   r) rr/r1 functoolsrZapirrr'r r__all__r r r rs  E