o ai@szddlZddlZddlZddlmZddlmZGdddeZedddefd d Z edddefd d Z dgZ dS) N) lru_cache)PlatformDirsABCc@seZdZdZedefddZedefddZedefddZedefd d Z edefd d Z edefd dZ edefddZ edefddZ edefddZdS)Androidz Follows the guidance `from here `_. Makes use of the `appname ` and `version `. returncC|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-python310-pip-21.3.1-5.el8.x86_64/opt/alt/python310/lib/python3.10/site-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`rr rrr site_data_dirzAndroid.site_data_dircCr)z :return: config directory tied to the user, e.g. ``/data/user///shared_prefs/`` Z shared_prefsr r rrruser_config_dirszAndroid.user_config_dircCr)zH:return: config directory shared by the users, same as `user_config_dir`)rr rrrsite_config_dir!rzAndroid.site_config_dircCr)zj:return: cache directory tied to the user, e.g. e.g. ``/data/user///cache/``cacher r rrruser_cache_dir&rzAndroid.user_cache_dircCr)zB:return: state directory tied to the user, same as `user_data_dir`rr rrruser_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`` logropinionospathjoinr r rrr user_log_dir0zAndroid.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_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`` tmprr"rrruser_runtime_dirBr$zAndroid.user_runtime_dirN)__name__ __module__ __qualname____doc__propertystrrrrrrrr#r&r(rrrrr s( r)maxsizercCsxzddlm}|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) jniusr1Z getFilesDirZ getParentFilegetAbsolutePath Exceptionrecompilesysr matchsplitOSError)r1Contextresultpatternr rrrr Ns    r cCsLzddlm}|d}|d}||j}W|Sty%d}Y|Sw)z,:return: documents folder for the Android OSrr0r2zandroid.os.Environmentz/storage/emulated/0/Documents)r3r1ZgetExternalFilesDirZDIRECTORY_DOCUMENTSr4r5)r1r< Environment documents_dirrrrr%cs  r%) rr6r8 functoolsrapirrr.r r%__all__rrrrs  E