a Re@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/``files_append_app_name_and_version_android_folderselfr/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/opt/alt/python39/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 rrr 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 rrruser_config_dirszAndroid.user_config_dircCs|jS)zH:return: config directory shared by the users, same as `user_config_dir`)rr rrrsite_config_dir!szAndroid.site_config_dircCs|tdS)zj:return: cache directory tied to the user, e.g. e.g. ``/data/user///cache/``cacher r rrruser_cache_dir&szAndroid.user_cache_dircCs|jS)zB:return: state directory tied to the user, same as `user_data_dir`rr rrruser_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`` logropinionospathjoinr rrrr user_log_dir0szAndroid.user_log_dircCstS)zf :return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents`` )_android_documents_folderr rrruser_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_dirBszAndroid.user_runtime_dirN)__name__ __module__ __qualname____doc__propertystrrrrrrrrr!r#rrrrr 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,Contextresultpatternrrrrr 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/r0)r,r7 Environment documents_dirrrrr cs   r ) rr1r3 functoolsrapirrr)r r __all__rrrrs  E