£Á°èZ¨Ä…–K§‚«“ô4“ÒÙ´dîfUÙÃÅ WKbyÊ¦•êŽ…È®FÒ¿ÊÎóCozá¬S@6{Í:›œêZÌ:Š•_%:¢¾¾~;‘Ã~èŠ©ÊÇí`ÔÑ©úë™µ'5I¿fš×WO%ø9¾«¾DK|€ùÍD”Ýs]nHÕ¶ê×Ó¼ãžªéUWŸÈË%DÒÕ¬ï‘]/Åcx  ‰ï2ß]ä6G[]S£ÔÏ¯rs{úëóµmÒï#UQxo·õÞCe]"±/aÙ&Eã4ú9Jé_ÞåëdãöKë)AÞ                  ¯¹ægƒÛowÐø^d™ý½ßB7áyMä9ÜÖUã
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<html>
B
    Ĥa'                 @  s   d dl mZ d dlZd dlZd dlmZ d dlmZ ddlm	Z	 G dd de	Z
d	d	d
ddZd	d	d
ddZd	d	d
ddZddddZedde ZdgZdS )    )annotationsN)	lru_cache)Callable   )PlatformDirsABCc               @  s   e Zd ZdZeddddZdddddd	d
dZeddddZeddddZeddddZ	eddddZ
eddddZeddddZeddddZeddddZdS )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)returnc             C  s(   | j r
dnd}tj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_dir   s    zWindows.user_data_dirN)opinion_valuez
str | None)r   r   r	   c            C  sr   g }| j r`| jdk	r*| jp| j }|| || j  |d k	rN| jrN|| | jr`|| j tjj|f| S )NF)appname	appauthorappendopinionversionr   r   join)r   r   r   paramsauthorr   r   r   r       s    


zWindows._append_partsc             C  s   t jtd}| |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    zWindows.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_dir3   s    zWindows.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_dir8   s    zWindows.site_config_dirc             C  s   t jtd}| j|d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   Cache)r   )r   r   r   r   r   )r   r   r   r   r   user_cache_dir=   s    zWindows.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_dirF   s    zWindows.user_state_dirc             C  s   | j }| jrtj|d}|S )zy
        :return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``Logs`` in it
        Logs)r   r   r   r   r   )r   r   r   r   r   user_log_dirK   s    zWindows.user_log_dirc             C  s   t jtd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_dirU   s    zWindows.user_documents_dirc             C  s$   t jt jtdd}| |S )z
        :return: runtime directory tied to the user, e.g.
         ``%USERPROFILE%\AppData\Local\Temp\$appauthor\$appname``
        r   ZTemp)r   r   r   r   r   r   )r   r   r   r   r   user_runtime_dir\   s    zWindows.user_runtime_dir)__name__
__module____qualname____doc__propertyr   r   r!   r"   r#   r%   r&   r(   r*   r+   r   r   r   r   r      s   	
r   r   )
csidl_namer	   c             C  sr   | dkr$t jt jt jd dS dddd| }|dkrLtd	|  t j|}|dkrntd
| |S )z&Get folder from environment variables.r)   USERPROFILEZ	DocumentsAPPDATAZALLUSERSPROFILEZLOCALAPPDATA)r
   r    r   NzUnknown CSIDL name: zUnset environment variable: )r   r   r   r   environget
ValueError)r1   Zenv_var_nameresultr   r   r   get_win_folder_from_env_varsf   s    r8   c             C  sX   ddddd | }|dkr*td|  ddl}||jd	}|||\}}t|S )
zGet 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.
    AppDatazCommon AppDatazLocal AppDataZPersonal)r
   r    r   r)   NzUnknown CSIDL name: r   z@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)r5   r6   winregOpenKeyHKEY_CURRENT_USERQueryValueExr   )r1   shell_folder_namer:   key	directory_r   r   r   get_win_folder_from_registryx   s    rB   c             C  s   ddddd | }|dkr*td|  td}ttd	}|jd|dd
| tdd |D rtd}|j	|j
|dr|}|j
S )zGet folder with ctypes.   #         )r
   r    r   r)   NzUnknown CSIDL name: i   windllr   c             s  s   | ]}t |d kV  qdS )   N)ord).0cr   r   r   	<genexpr>   s    z,get_win_folder_via_ctypes.<locals>.<genexpr>)r5   r6   ctypescreate_unicode_buffergetattrshell32SHGetFolderPathWanykernel32GetShortPathNameWvalue)r1   csidl_constbufrG   buf2r   r   r   get_win_folder_via_ctypes   s    


rY   zCallable[[str], str])r	   c              C  s8   t tdrtS ydd l} W n tk
r.   tS X tS d S )NrG   r   )hasattrrM   rY   r:   ImportErrorr8   rB   )r:   r   r   r   _pick_get_win_folder   s    
r\   )maxsize)
__future__r   rM   r   	functoolsr   typingr   Zapir   r   r8   rB   rY   r\   r   __all__r   r   r   r   <module>   s   [