a oe@sddlmZddlZddlZddlZddlmZddlmZddl m Z Gddde Z edd d d d d Z edd dd ddZ dgZdS)) annotationsN) lru_cache)cast)PlatformDirsABCc@seZdZdZeddddZeddddZedddd Zeddd d Zeddd d Z eddddZ eddddZ eddddZ eddddZ dS)Androidz Follows the guidance `from here `_. Makes use of the `appname ` and `version `. strreturncCs|tttdS)zd:return: data directory tied to the user, e.g. ``/data/user///files/``filesZ_append_app_name_and_versionrr_android_folderselfrKC:\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|tttdS)z :return: config directory tied to the user, e.g. ``/data/user///shared_prefs/`` Z shared_prefsr rrrruser_config_dirszAndroid.user_config_dircCs|jS)zH:return: config directory shared by the users, same as `user_config_dir`)rrrrrsite_config_dir$szAndroid.site_config_dircCs|tttdS)zj:return: cache directory tied to the user, e.g. e.g. ``/data/user///cache/``cacher rrrruser_cache_dir)szAndroid.user_cache_dircCs|jS)zB:return: state directory tied to the user, same as `user_data_dir`rrrrruser_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`` logrZopinionospathjoinrrrrr user_log_dir3szAndroid.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_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`` tmprrrrruser_runtime_dirEszAndroid.user_runtime_dirN)__name__ __module__ __qualname____doc__propertyrrrrrrr r"r$rrrrr s& r)maxsizez str | Noner cCsvz(ddlm}|d}|}WnHtyptd}tj D] }| |rF| dd}qlqFd}Yn0|S)zB:return: base folder for the Android OS or None if cannot be foundr autoclassandroid.content.Contextz /data/(data|user/\d+)/(.+)/filesz/filesN) jniusr,Z getFilesDirZ getParentFilegetAbsolutePath Exceptionrecompilesysrmatchsplit)r,Contextresultpatternrrrrr 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 functoolsrtypingrZapirrr r!__all__rrrrs    E