AlkantarClanX12

Your IP : 18.218.2.191


Current Path : /opt/alt/python37/lib/python3.7/site-packages/platformdirs/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib/python3.7/site-packages/platformdirs/__pycache__/windows.cpython-37.pyc

B

Ĥ�a'�@s�ddlmZddlZddlZddlmZddlmZddlm	Z	Gdd�de	�Z
d	d	d
�dd�Zd	d	d
�d
d�Zd	d	d
�dd�Z
dd�dd�Zedd�e��ZdgZdS)�)�annotationsN)�	lru_cache)�Callable�)�PlatformDirsABCc@s�eZdZdZedd�dd��Zdd�dddd	�d
d�Zedd�dd
��Zedd�dd��Zedd�dd��Z	edd�dd��Z
edd�dd��Zedd�dd��Zedd�dd��Z
edd�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>`.�str)�returncCs(|jr
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)�roaming�os�path�normpath�get_win_folder�
_append_parts)�self�constr�r�E/opt/alt/python37/lib/python3.7/site-packages/platformdirs/windows.py�
user_data_dirszWindows.user_data_dirN)�
opinion_valuez
str | None)rrr	cCsrg}|jr`|jdk	r*|jp|j}|�|�|�|j�|dk	rN|jrN|�|�|jr`|�|j�tjj|f|��S)NF)�appname�	appauthor�append�opinion�versionr
r�join)rrr�params�authorrrrr s


zWindows._append_partscCstj�td��}|�|�S)zT:return: data directory shared by users, e.g. ``C:\ProgramData\$appauthor\$appname``�CSIDL_COMMON_APPDATA)r
rrrr)rrrrr�
site_data_dir-szWindows.site_data_dircCs|jS)zC:return: config directory tied to the user, same as `user_data_dir`)r)rrrr�user_config_dir3szWindows.user_config_dircCs|jS)zF:return: config directory shared by the users, same as `site_data_dir`)r!)rrrr�site_config_dir8szWindows.site_config_dircCstj�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�Cache)r)r
rrrr)rrrrr�user_cache_dir=szWindows.user_cache_dircCs|jS)zB:return: state directory tied to the user, same as `user_data_dir`)r)rrrr�user_state_dirFszWindows.user_state_dircCs|j}|jrtj�|d�}|S)zy
        :return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in it
        �Logs)rrr
rr)rrrrr�user_log_dirKszWindows.user_log_dircCstj�td��S)z`
        :return: documents directory tied to the user e.g. ``%USERPROFILE%\Documents``
        �CSIDL_PERSONAL)r
rrr)rrrr�user_documents_dirUszWindows.user_documents_dircCs$tj�tj�td�d��}|�|�S)z�
        :return: runtime directory tied to the user, e.g.
         ``%USERPROFILE%\AppData\Local\Temp\$appauthor\$appname``
        rZTemp)r
rrrrr)rrrrr�user_runtime_dir\szWindows.user_runtime_dir)�__name__�
__module__�__qualname__�__doc__�propertyrrr!r"r#r%r&r(r*r+rrrrrs
	
rr)�
csidl_namer	cCsr|dkr$tj�tj�tjd�d�Sdddd��|�}|dkrLtd	|����tj�|�}|dkrntd
|����|S)z&Get folder from environment variables.r)�USERPROFILEZ	Documents�APPDATAZALLUSERSPROFILEZLOCALAPPDATA)r
r rNzUnknown CSIDL name: zUnset environment variable: )r
rrr�environ�get�
ValueError)r1Zenv_var_name�resultrrr�get_win_folder_from_env_varsfsr8cCsXddddd��|�}|dkr*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.
    �AppDatazCommon AppDataz
Local AppDataZPersonal)r
r rr)NzUnknown CSIDL name: rz@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)r5r6�winreg�OpenKey�HKEY_CURRENT_USER�QueryValueExr)r1�shell_folder_namer:�key�	directory�_rrr�get_win_folder_from_registryxsrBcCs�ddddd��|�}|dkr*td|����t�d�}ttd	�}|j�d|dd
|�tdd�|D��r�t�d�}|j�	|j
|d�r�|}|j
S)
zGet folder with ctypes.��#��)r
r rr)NzUnknown CSIDL name: i�windllrcss|]}t|�dkVqdS)�N)�ord)�.0�crrr�	<genexpr>�sz,get_win_folder_via_ctypes.<locals>.<genexpr>)r5r6�ctypes�create_unicode_buffer�getattr�shell32�SHGetFolderPathW�any�kernel32�GetShortPathNameW�value)r1�csidl_const�bufrG�buf2rrr�get_win_folder_via_ctypes�s


rYzCallable[[str], str])r	cCs8ttd�rtSyddl}Wntk
r.tSXtSdS)NrGr)�hasattrrMrYr:�ImportErrorr8rB)r:rrr�_pick_get_win_folder�s
r\)�maxsize)�
__future__rrMr
�	functoolsr�typingrZapirrr8rBrYr\r�__all__rrrr�<module>s[