a „oeäã@s’ddlmZddlZddlZddlZddlmZddlmZddl m Z Gdd„de ƒZ edd �d d œd d „ƒZ edd �dd œdd„ƒZ dgZdS)é)Ú annotationsN)Ú lru_cache)Úcasté)ÚPlatformDirsABCc@s²eZdZdZeddœdd„ƒZeddœdd„ƒZeddœdd „ƒZeddœd d „ƒZeddœd d „ƒZ eddœdd„ƒZ eddœdd„ƒZ eddœdd„ƒZ eddœdd„ƒZ dS)ÚAndroidzá Follows the guidance `from here `_. Makes use of the `appname ` and `version `. Ústr©ÚreturncCs| tttƒƒd¡S)zd:return: data directory tied to the user, e.g. ``/data/user///files/``Úfiles©Z_append_app_name_and_versionrrÚ_android_folder©Úself©rúKC:\Program Files\Certbot\pkgs\pkg_resources\_vendor\platformdirs\android.pyÚ user_data_dirszAndroid.user_data_dircCs|jS)z@:return: data directory shared by users, same as `user_data_dir`©rrrrrÚ site_data_dirszAndroid.site_data_dircCs| tttƒƒd¡S)z :return: config directory tied to the user, e.g. ``/data/user///shared_prefs/`` Z shared_prefsr rrrrÚuser_config_dirszAndroid.user_config_dircCs|jS)zH:return: config directory shared by the users, same as `user_config_dir`)rrrrrÚsite_config_dir$szAndroid.site_config_dircCs| tttƒƒd¡S)zj:return: cache directory tied to the user, e.g. e.g. ``/data/user///cache/``Úcacher rrrrÚuser_cache_dir)szAndroid.user_cache_dircCs|jS)zB:return: state directory tied to the user, same as `user_data_dir`rrrrrÚuser_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`` Úlog©rZopinionÚosÚpathÚjoin©rrrrrÚ user_log_dir3szAndroid.user_log_dircCstƒS)zf :return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents`` )Ú_android_documents_folderrrrrÚuser_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`` ÚtmprrrrrÚuser_runtime_dirEszAndroid.user_runtime_dirN)Ú__name__Ú __module__Ú __qualname__Ú__doc__Úpropertyrrrrrrr r"r$rrrrr s& r)Úmaxsizez str | Noner cCsvz(ddlm}|dƒ}| ¡ ¡ ¡}WnHtypt d¡}tj D] }|  |¡rF|  d¡d}qlqFd}Yn0|S)zB:return: base folder for the Android OS or None if cannot be foundr©Ú autoclassúandroid.content.Contextz /data/(data|user/\d+)/(.+)/filesz/filesN) Újniusr,Z getFilesDirZ getParentFileÚgetAbsolutePathÚ ExceptionÚreÚcompileÚsysrÚmatchÚsplit)r,ÚContextÚresultÚpatternrrrrr Qs      r rcCsLz0ddlm}|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/r0)r,r6Z EnvironmentZ documents_dirrrrr!fs   r!)Z __future__rrr1r3Ú functoolsrÚtypingrZapirrr r!Ú__all__rrrrÚs    Eÿ