관리-도구
편집 파일: windows.cpython-39.pyc
a ����[��f����������������������@���s����d�dl�Z�d�dlZd�dlmZ�d�dlmZmZ�ddlmZ�G�dd��de�Z e e d�d d �Ze e d�dd�Ze e d�d d�Z ee ge f�d�dd�Zedd�e���ZdgZdS�)�����N)� lru_cache)�Callable�Optional����)�PlatformDirsABCc�������������������@���s����e�Zd�ZdZeed�dd��Zdd�eee�ed�dd �Zeed�d d��Z eed�dd ��Z eed�dd��Zeed�dd��Zeed�dd��Z eed�dd��Zeed�dd��Zeed�dd��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>`.��returnc�����������������C���s(���|�j�r dnd}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)Zroaming�os�path�normpath�get_win_folder� _append_parts)�self�constr �����r����D/usr/lib/python3.9/site-packages/pip/_vendor/platformdirs/windows.py� user_data_dir���s����zWindows.user_data_dirN�� opinion_value)r ���r���r ���c����������������C���st���g�}|�j�r`|�jdur*|�jp|�j�}|�|��|�|�j���|d�urN|�jrN|�|��|�jr`|�|�j��tjj|g|�R���S�)NF)ZappnameZ appauthor�append�opinion�versionr���r ����join)r���r ���r����paramsZauthorr���r���r���r������s���� zWindows._append_partsc�����������������C���s���t�j�td��}|��|�S�)zT:return: data directory shared by users, e.g. ``C:\ProgramData\$appauthor\$appname``�CSIDL_COMMON_APPDATA�r���r ���r���r���r����r���r ���r���r���r���� site_data_dir+���s����zWindows.site_data_dirc�����������������C���s���|�j�S�)zC:return: config directory tied to the user, same as `user_data_dir`�r����r���r���r���r����user_config_dir1���s����zWindows.user_config_dirc�����������������C���s���|�j�S�)zF:return: config directory shared by the users, same as `site_data_dir`)r ���r"���r���r���r����site_config_dir6���s����zWindows.site_config_dirc�����������������C���s���t�j�td��}|�j|dd�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���ZCacher���r���r���r���r���r����user_cache_dir;���s����zWindows.user_cache_dirc�����������������C���s���|�j�S�)zB:return: state directory tied to the user, same as `user_data_dir`r!���r"���r���r���r����user_state_dirD���s����zWindows.user_state_dirc�����������������C���s���|�j�}|�jrtj�|d�}|S�)zy :return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in it ZLogs)r���r���r���r ���r���r���r���r���r����user_log_dirI���s����zWindows.user_log_dirc�����������������C���s���t�j�td��S�)z` :return: documents directory tied to the user e.g. ``%USERPROFILE%\Documents`` �CSIDL_PERSONAL)r���r ���r���r���r"���r���r���r����user_documents_dirS���s����zWindows.user_documents_dirc�����������������C���s$���t�j�t�j�td�d��}|��|�S�)z� :return: runtime directory tied to the user, e.g. ``%USERPROFILE%\AppData\Local\Temp\$appauthor\$appname`` r���ZTemp)r���r ���r���r���r���r���r���r���r���r����user_runtime_dirZ���s����zWindows.user_runtime_dir)�__name__� __module__�__qualname__�__doc__�property�strr���r���r���r ���r#���r$���r%���r&���r'���r)���r*���r���r���r���r���r��� ���s(��� r���)� csidl_namer ���c�����������������C���sr���|�dkr$t�j�t�j�t�jd��d�S�dddd��|��}|du�rLtd |������t�j�|�}|du�rntd |�����|S�)z&Get folder from environment variables.r(����USERPROFILEZ Documents�APPDATAZALLUSERSPROFILEZLOCALAPPDATA)r ���r���r���N�Unknown CSIDL name: zUnset environment variable: )r���r ���r���r����environ�get� ValueError)r1���Zenv_var_name�resultr���r���r����get_win_folder_from_env_varsd���s������r9���c�����������������C���sX���ddddd���|��}|du�r*td|������ddl}|�|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. ZAppDatazCommon AppDataz Local AppDataZPersonal�r ���r���r���r(���Nr4���r���z@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)r6���r7����winreg�OpenKey�HKEY_CURRENT_USERZQueryValueExr0���)r1���Zshell_folder_namer;����keyZ directory�_r���r���r����get_win_folder_from_registryv���s������r@���c�����������������C���s����ddddd���|��}|du�r*td|������t�d�}ttd �}|j�d|dd |��tdd��|D���r�t�d�}|j� |j |d�r�|}|j S�) zGet folder with ctypes.�����#�����������r:���Nr4���i����windllr���c�����������������s���s���|�]}t�|�d�kV��qdS�)����N)�ord)�.0�cr���r���r���� <genexpr>���������z,get_win_folder_via_ctypes.<locals>.<genexpr>)r6���r7����ctypesZcreate_unicode_buffer�getattrZshell32ZSHGetFolderPathW�anyZkernel32ZGetShortPathNameW�value)r1���Zcsidl_const�bufrE���Zbuf2r���r���r����get_win_folder_via_ctypes����s"������ rQ���r���c������������������C���s:���t�td�rtS�zdd�l}�W�n�ty0���t�Y�S�0�tS�d�S�)NrE���r���)�hasattrrL���rQ���r;����ImportErrorr9���r@���)r;���r���r���r����_pick_get_win_folder����s���� rT���)�maxsize)rL���r���� functoolsr����typingr���r���Zapir���r���r0���r9���r@���rQ���rT���r����__all__r���r���r���r����<module>���s���[�