B Ĥa@sddlmZddlZddlZddlZddlmZddlmZGdddeZ eddd d d d Z eddd d d dZ dgZ dS)) annotationsN) lru_cache)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 `. str)returncCs|tdS)zd:return: data directory tied to the user, e.g. ``/data/user///files/``files)_append_app_name_and_version_android_folder)selfr E/opt/alt/python37/lib/python3.7/site-packages/platformdirs/android.py user_data_dirszAndroid.user_data_dircCs|jS)z@:return: data directory shared by users, same as `user_data_dir`)r)r 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_prefs)r r )r r r ruser_config_dirszAndroid.user_config_dircCs|jS)zH:return: config directory shared by the users, same as `user_config_dir`)r)r 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/``cache)r r )r r r ruser_cache_dir(szAndroid.user_cache_dircCs|jS)zB:return: state directory tied to the user, same as `user_data_dir`)r)r 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`` log)ropinionospathjoin)r rr r r user_log_dir2szAndroid.user_log_dircCstS)zf :return: documents directory tied to the user e.g. ``/storage/emulated/0/Documents`` )_android_documents_folder)r 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`` tmp)rrrrr)r rr r ruser_runtime_dirDszAndroid.user_runtime_dirN)__name__ __module__ __qualname____doc__propertyrrrrrrrrrr r r rr s r)maxsizer)rcCs~y(ddlm}|d}|}WnPtk rxtd}x0tj D]}| |rJ| dd}PqJWt dYnX|S)z':return: base folder for the Android OSr) autoclasszandroid.content.Contextz /data/(data|user/\d+)/(.+)/filesz/filesz&Cannot find path to android app folder) jniusr&Z getFilesDirZ getParentFilegetAbsolutePath ExceptionrecompilesysrmatchsplitOSError)r&Contextresultpatternrr r rr Ps    r cCsNy0ddlm}|d}|d}||j}Wntk rHd}YnX|S)z,:return: documents folder for the Android OSr)r&zandroid.content.Contextzandroid.os.Environmentz/storage/emulated/0/Documents)r'r&ZgetExternalFilesDirZDIRECTORY_DOCUMENTSr(r))r&r0 EnvironmentZ documents_dirr r rres  r) __future__rrr*r, functoolsrZapirrr r__all__r r r rs   E