HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/platformdirs/__pycache__/windows.cpython-310.pyc
o

j�h�'�@s�dZddlmZddlZddlZddlmZddlmZddl	m
Z
er*ddlmZGd	d
�d
e
�Z
ddd�Zddd�Zddd�Zddd�Zddd�Zedd�e��Zd
gZdS)zWindows.�)�annotationsN)�	lru_cache)�
TYPE_CHECKING�)�PlatformDirsABC)�Callablec@seZdZdZed+dd��Zdd�d,dd�Zed+d
d��Zed+dd��Zed+dd��Z	ed+dd��Z
ed+dd��Zed+dd��Zed+dd��Z
ed+dd��Zed+dd��Zed+dd ��Zed+d!d"��Zed+d#d$��Zed+d%d&��Zed+d'd(��Zed+d)d*��ZdS)-�Windowsa�
    `MSDN on where to store app data files <https://learn.microsoft.com/en-us/windows/win32/shell/knownfolderid>`_.

    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>`, `ensure_exists
    <platformdirs.api.PlatformDirsABC.ensure_exists>`.

    �return�strcCs(|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�constr�r�?/usr/local/lib/python3.10/dist-packages/platformdirs/windows.py�
user_data_dirs
zWindows.user_data_dirN��
opinion_valuerr�
str | NonecCs�g}|jr0|jdur|jp|j}|�|�|�|j�|dur'|jr'|�|�|jr0|�|j�tjj|g|�R�}|�|�|S)NF)	�appname�	appauthor�append�opinion�versionrr�join�_optionally_create_directory)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�rrrrr�rrrrr�
site_data_dir5s
zWindows.site_data_dircC�|jS)zC:return: config directory tied to the user, same as `user_data_dir`�r�rrrr�user_config_dir;�zWindows.user_config_dircCr()zF:return: config directory shared by the users, same as `site_data_dir`)r'r*rrr�site_config_dir@r,zWindows.site_config_dircC�tj�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�Cacherr%r&rrr�user_cache_dirEszWindows.user_cache_dircCr.)zd:return: cache directory shared by users, e.g. ``C:\ProgramData\$appauthor\$appname\Cache\$version``r$r/rr%r&rrr�site_cache_dirNszWindows.site_cache_dircCr()zB:return: state directory tied to the user, same as `user_data_dir`r)r*rrr�user_state_dirTr,zWindows.user_state_dircCs(|j}|jrtj�|d�}|�|�|S)zg:return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in it�Logs)rrrrr r!r&rrr�user_log_dirYs

zWindows.user_log_dircC�tj�td��S)zN:return: documents directory tied to the user e.g. ``%USERPROFILE%\Documents``�CSIDL_PERSONAL�rrrrr*rrr�user_documents_dirb�zWindows.user_documents_dircCr5)zN:return: downloads directory tied to the user e.g. ``%USERPROFILE%\Downloads``�CSIDL_DOWNLOADSr7r*rrr�user_downloads_dirgr9zWindows.user_downloads_dircCr5)zL:return: pictures directory tied to the user e.g. ``%USERPROFILE%\Pictures``�CSIDL_MYPICTURESr7r*rrr�user_pictures_dirlr9zWindows.user_pictures_dircCr5)zH:return: videos directory tied to the user e.g. ``%USERPROFILE%\Videos``�
CSIDL_MYVIDEOr7r*rrr�user_videos_dirqr9zWindows.user_videos_dircCr5)zF:return: music directory tied to the user e.g. ``%USERPROFILE%\Music``�
CSIDL_MYMUSICr7r*rrr�user_music_dirvr9zWindows.user_music_dircCr5)zK:return: desktop directory tied to the user, e.g. ``%USERPROFILE%\Desktop``�CSIDL_DESKTOPDIRECTORYr7r*rrr�user_desktop_dir{r9zWindows.user_desktop_dircCs$tj�tj�td�d��}|�|�S)z�
        :return: runtime directory tied to the user, e.g.
         ``%USERPROFILE%\AppData\Local\Temp\$appauthor\$appname``
        r�Temp)rrrr rrr&rrr�user_runtime_dir�s
zWindows.user_runtime_dircCr()zF:return: runtime directory shared by users, same as `user_runtime_dir`)rEr*rrr�site_runtime_dir�r,zWindows.site_runtime_dir)r	r
)rr
rrr	r
)�__name__�
__module__�__qualname__�__doc__�propertyrrr'r+r-r0r1r2r4r8r;r=r?rArCrErFrrrrrsF

r�
csidl_namer
r	cCsjt|�}|dur
|Sdddd��|�}|dur d|��}t|��tj�|�}|dur3d|��}t|��|S)z&Get folder from environment variables.N�APPDATA�ALLUSERSPROFILE�LOCALAPPDATA)rr$r�Unknown CSIDL name: zUnset environment variable: )�(get_win_folder_if_csidl_name_not_env_var�get�
ValueErrorr�environ)rL�result�env_var_name�msgrrr�get_win_folder_from_env_vars�s"��

rXrcCs�|dkrtj�tj�tjd�d�S|dkr$tj�tj�tjd�d�S|dkr6tj�tj�tjd�d�S|dkrHtj�tj�tjd�d	�S|d
krZtj�tj�tjd�d�SdS)
zMGet a folder for a CSIDL name that does not exist as an environment variable.r6�USERPROFILE�	Documentsr:�	Downloadsr<�Picturesr>�Videosr@�MusicN)rrr rrT)rLrrrrQ�srQc	Csrddddddddd	��|�}|d
urd|��}t|��tjdkr"t�d
d
l}|�|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 these guarantees us the correct answer
    for all CSIDL_* names.

    �AppDatazCommon AppDataz
Local AppData�Personalz&{374DE290-123F-4565-9164-39C4925E467B}zMy PictureszMy VideozMy Music)rr$rr6r:r<r>r@NrP�win32rz@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)
rRrS�sys�platform�NotImplementedError�winreg�OpenKey�HKEY_CURRENT_USER�QueryValueExr
)rL�shell_folder_namerWre�key�	directory�_rrr�get_win_folder_from_registry�s(	�	�


rmc
Cs�ddl}ddddddd	d
dd�	�|�}|dur d
|��}t|��|�d�}t|d�}|j�d|dd|�tdd�|D��rM|�d�}|j�	|j
|d�rM|}|dkrYtj�
|j
d�S|j
S)zGet folder with ctypes.rN��#���'��
�(�)	rr$rr6r<r>r@r:rBrPi�windllcss�|]	}t|�dkVqdS)�N)�ord)�.0�crrr�	<genexpr>�s�z,get_win_folder_via_ctypes.<locals>.<genexpr>r:r[)�ctypesrRrS�create_unicode_buffer�getattr�shell32�SHGetFolderPathW�any�kernel32�GetShortPathNameW�valuerrr )rLr}�csidl_constrW�bufrw�buf2rrr�get_win_folder_via_ctypes�s4�
�



r��Callable[[str], str]cCsTzddl}Wn	tyYnwt|d�rtSzddl}WtSty)tYSw)Nrrw)r}�ImportError�hasattrr�rerXrm)r}rerrr�_pick_get_win_folder�s�

��r�)�maxsize)rLr
r	r
)rLr
r	r)r	r�)rJ�
__future__rrrb�	functoolsr�typingr�apir�collections.abcrrrXrQrmr�r�r�__all__rrrr�<module>s$




'�