Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/platformdirs/__pycache__/windows.cpython-311.pyc
�

o�d�����ddlmZddlZddlZddlZddlmZddlmZddl	m
Z
Gd�de
��Zdd�Zdd
�Z
dd�Zdd�Zed���e����ZdgZdS)�)�annotationsN)�	lru_cache)�Callable�)�PlatformDirsABCc��eZdZdZedd���Zdd�dd
�Zedd���Zedd���Zedd
���Z	edd���Z
edd���Zedd���Zedd���Z
edd���ZdS)�Windowsa�`MSDN on where to store app data files
    <http://support.microsoft.com/default.aspx?scid=kb;en-us;310294#XSLTH3194121123120121120120>`_.
    Makes use of the
    `appname <platformdirs.api.PlatformDirsABC.appname>`,
    `appauthor <platformdirs.api.PlatformDirsABC.appauthor>`,
    `version <platformdirs.api.PlatformDirsABC.version>`,
    `roaming <platformdirs.api.PlatformDirsABC.roaming>`,
    `opinion <platformdirs.api.PlatformDirsABC.opinion>`.�return�strc��|jrdnd}tj�t	|����}|�|��S)z�
        :return: data directory tied to the user, e.g.
         ``%USERPROFILE%\AppData\Local\$appauthor\$appname`` (not roaming) or
         ``%USERPROFILE%\AppData\Roaming\$appauthor\$appname`` (roaming)
        �
CSIDL_APPDATA�CSIDL_LOCAL_APPDATA)�roaming�os�path�normpath�get_win_folder�
_append_parts)�self�constrs   �e/builddir/build/BUILD/cloudlinux-venv-1.0.2/venv/lib/python3.11/site-packages/platformdirs/windows.py�
user_data_dirzWindows.user_data_dirsF��$(�<�J���5J���w����u� 5� 5�6�6���!�!�$�'�'�'�N��
opinion_valuerr�
str | Nonec�L�g}|jr�|jdur#|jp|j}|�|��|�|j��|�|jr|�|��|jr|�|j��tjj|g|�R�S)NF)�appname�	appauthor�append�opinion�versionrr�join)rrr�params�authors     rrzWindows._append_parts!s������<�	,��~�U�*�*���7�4�<���
�
�f�%�%�%��M�M�$�,�'�'�'��(�T�\�(��
�
�m�,�,�,��|�
,��
�
�d�l�+�+�+��w�|�D�*�6�*�*�*�*rc��tj�td����}|�|��S)zT:return: data directory shared by users, e.g. ``C:\ProgramData\$appauthor\$appname``�CSIDL_COMMON_APPDATA�rrrrr�rrs  r�
site_data_dirzWindows.site_data_dir.s6���w����/E� F� F�G�G���!�!�$�'�'�'rc��|jS)zC:return: config directory tied to the user, same as `user_data_dir`�r�rs r�user_config_dirzWindows.user_config_dir4�
���!�!rc��|jS)zF:return: config directory shared by the users, same as `site_data_dir`)r*r-s r�site_config_dirzWindows.site_config_dir9r/rc��tj�td����}|�|d���S)z�
        :return: cache directory tied to the user (if opinionated with ``Cache`` folder within ``$appname``) e.g.
         ``%USERPROFILE%\AppData\Local\$appauthor\$appname\Cache\$version``
        r�Cacherr(r)s  r�user_cache_dirzWindows.user_cache_dir>s;���w����/D� E� E�F�F���!�!�$�g�!�>�>�>rc��|jS)zB:return: state directory tied to the user, same as `user_data_dir`r,r-s r�user_state_dirzWindows.user_state_dirGr/rc�b�|j}|jr tj�|d��}|S)zy
        :return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in it
        �Logs)rr!rrr#r)s  r�user_log_dirzWindows.user_log_dirLs0��
�!���<�	.��7�<�<��f�-�-�D��rc�Z�tj�td����S)z`
        :return: documents directory tied to the user e.g. ``%USERPROFILE%\Documents``
        �CSIDL_PERSONAL)rrrrr-s r�user_documents_dirzWindows.user_documents_dirVs#��
�w����/?� @� @�A�A�Arc��tj�tj�t	d��d����}|�|��S)z�
        :return: runtime directory tied to the user, e.g.
         ``%USERPROFILE%\AppData\Local\Temp\$appauthor\$appname``
        r�Temp)rrrr#rrr)s  r�user_runtime_dirzWindows.user_runtime_dir]sG���w�������^�<Q�-R�-R�TZ� [� [�\�\���!�!�$�'�'�'r)r
r)rrrrr
r)�__name__�
__module__�__qualname__�__doc__�propertyrrr*r.r1r4r6r9r<r?�rrr	r	sg������=�=��(�(�(��X�(�GK�+�+�+�+�+�+��(�(�(��X�(�
�"�"�"��X�"��"�"�"��X�"��?�?�?��X�?��"�"�"��X�"������X���B�B�B��X�B��(�(�(��X�(�(�(rr	�
csidl_namerr
c�l�|dkrMtj�tj�tjd��d��Sdddd��|��}|�t
d	|�����tj�|��}|�t
d
|�����|S)z&Get folder from environment variables.r;�USERPROFILE�	Documents�APPDATA�ALLUSERSPROFILE�LOCALAPPDATA)r
r'rN�Unknown CSIDL name: zUnset environment variable: )rrr#r�environ�get�
ValueError)rF�env_var_name�results   r�get_win_folder_from_env_varsrSgs����%�%�%��w�|�|�B�G�,�,�R�Z�
�-F�G�G��U�U�U�#� 1�-���
�c�*�o�o�	�
���<�
�<�<�=�=�=�
�Z�^�^�L�
)�
)�F�
�~��F��F�F�G�G�G��Mrc��ddddd��|��}|�td|�����tjdkrt�d	dl}|�|jd
��}|�||��\}}t|��S)z�Get folder from the registry.

    This is a fallback technique at best. I'm not sure if using the
    registry for this guarantees us the correct answer for all CSIDL_*
    names.
    �AppDatazCommon AppDataz
Local AppData�Personal�r
r'rr;NrM�win32rz@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)
rOrP�sys�platform�NotImplementedError�winreg�OpenKey�HKEY_CURRENT_USER�QueryValueExr)rF�shell_folder_namer\�key�	directory�_s      r�get_win_folder_from_registryrdys���#� 0�.�$�	��

�c�*�o�o��� ��<�
�<�<�=�=�=�
�|�w���!�!��M�M�M�
�.�.��1�3v�
w�
w�C��&�&�s�,=�>�>�L�I�q��y�>�>�rc��ddddd��|��}|�td|�����tjd��}t	td	��}|j�d|dd
|��td�|D����r7tjd��}|j�	|j
|d��r|}|j
S)zGet folder with ctypes.��#��rWNrMi�windllrc3�<K�|]}t|��dkV��dS)�N)�ord)�.0�cs  r�	<genexpr>z,get_win_folder_via_ctypes.<locals>.<genexpr>�s,����
%�
%�A�3�q�6�6�C�<�
%�
%�
%�
%�
%�
%r)rOrP�ctypes�create_unicode_buffer�getattr�shell32�SHGetFolderPathW�any�kernel32�GetShortPathNameW�value)rF�csidl_const�bufrj�buf2s     r�get_win_folder_via_ctypesr}�s���� "�!��	��

�c�*�o�o�����<�
�<�<�=�=�=�
�
&�t�
,�
,�C�
�V�X�
&�
&�F�
�N�#�#�D�+�t�Q��D�D�D��
%�
%��
%�
%�
%�%�%���+�D�1�1���?�,�,�S�Y��d�C�C�	��C��9�r�Callable[[str], str]c��ttd��rtS	ddl}tS#t
$r
tcYSwxYw)Nrjr)�hasattrrqr}r\rd�ImportErrorrS)r\s r�_pick_get_win_folderr��sY���v�x� � �)�(�(�,��
�
�
�,�+���,�,�,�+�+�+�+�,���s�)�=�=)�maxsize)rFrr
r)r
r~)�
__future__rrqrrY�	functoolsr�typingr�apirr	rSrdr}r�r�__all__rErr�<module>r�s#��"�"�"�"�"�"�
�
�
�
�	�	�	�	�
�
�
�
������������� � � � � � �X(�X(�X(�X(�X(�o�X(�X(�X(�v����$����0����0,�,�,�,�)���4�(�(�(�)=�)=�)?�)?�@�@������r