§
     he%  ã                  óæ   — d Z ddlmZ ddlZddlZddlZddlmZ ddlm	Z	 ddl
mZ e	rddlmZ  G d	„ d
e¦  «        Zdd„Zdd„Zdd„Zdd„Zdd„Z  ed¬¦  «         e¦   «         ¦  «        Zd
gZdS )zWindows.é    )ÚannotationsN)Ú	lru_cache)ÚTYPE_CHECKINGé   )ÚPlatformDirsABC)ÚCallablec                  óp  — e Zd ZdZedd„¦   «         Zddœdd
„Zedd„¦   «         Zedd„¦   «         Zedd„¦   «         Z	edd„¦   «         Z
edd„¦   «         Zedd„¦   «         Zedd„¦   «         Zedd„¦   «         Zedd„¦   «         Zedd„¦   «         Zedd„¦   «         Zedd„¦   «         Ze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>`,
    `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.
    ÚreturnÚstrc                óš   — | 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   s      úZc:\xampp_lite_8_4\www\timesheet\venv\Lib\site-packages\pip/_vendor/platformdirs/windows.pyÚuser_data_dirzWindows.user_data_dir   sF   € ð $(¤<ÐJ��Ð5JˆÝŒw×Ò¥¨uÑ 5Ô 5Ñ6Ô6ˆØ×!Ò! $Ñ'Ô'Ð'ó    N©Úopinion_valuer   r   ú
str | Nonec               óz  — g }| j         r…| j        dur#| j        p| j         }|                     |¦  «         |                     | j         ¦  «         |�| j        r|                     |¦  «         | j        r|                     | j        ¦  «         t          j        j        |g|¢R Ž }|                      |¦  «         |S )NF)	ÚappnameÚ	appauthorÚappendÚopinionÚversionr   r   ÚjoinÚ_optionally_create_directory)r   r   r   ÚparamsÚauthors        r   r   zWindows._append_parts(   sÁ   € ØˆØŒ<ð 	,ØŒ~ UÐ*Ð*ØœÐ7¨4¬<�Ø—’˜fÑ%Ô%Ð%Ø�MŠM˜$œ,Ñ'Ô'Ð'ØÐ(¨T¬\Ð(Ø—’˜mÑ,Ô,Ð,ØŒ|ð ,Ø—’˜dœlÑ+Ô+Ð+ÝŒwŒ|˜DÐ* 6Ð*Ð*Ð*ˆØ×)Ò)¨$Ñ/Ô/Ð/Øˆr   c                ó„   — 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   s     r   Úsite_data_dirzWindows.site_data_dir7   s6   € õ Œw×Ò¥Ð/EÑ FÔ FÑGÔGˆØ×!Ò! $Ñ'Ô'Ð'r   c                ó   — | j         S )zC:return: config directory tied to the user, same as `user_data_dir`©r   ©r   s    r   Úuser_config_dirzWindows.user_config_dir=   ó   € ð Ô!Ð!r   c                ó   — | j         S )zF:return: config directory shared by the users, same as `site_data_dir`)r,   r/   s    r   Úsite_config_dirzWindows.site_config_dirB   r1   r   c                óˆ   — t           j                             t          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   ÚCacher   r*   r+   s     r   Úuser_cache_dirzWindows.user_cache_dirG   s;   € õ Œw×Ò¥Ð/DÑ EÔ EÑFÔFˆØ×!Ò! $°gÐ!Ñ>Ô>Ð>r   c                óˆ   — t           j                             t          d¦  «        ¦  «        }|                      |d¬¦  «        S )zd:return: cache directory shared by users, e.g. ``C:\ProgramData\$appauthor\$appname\Cache\$version``r)   r5   r   r*   r+   s     r   Úsite_cache_dirzWindows.site_cache_dirP   s;   € õ Œw×Ò¥Ð/EÑ FÔ FÑGÔGˆØ×!Ò! $°gÐ!Ñ>Ô>Ð>r   c                ó   — | j         S )zB:return: state directory tied to the user, same as `user_data_dir`r.   r/   s    r   Úuser_state_dirzWindows.user_state_dirV   r1   r   c                óŒ   — | j         }| j        r5t          j                             |d¦  «        }|                      |¦  «         |S )zg: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+   s     r   Úuser_log_dirzWindows.user_log_dir[   sD   € ð Ô!ˆØŒ<ð 	4Ý”7—<’<  fÑ-Ô-ˆDØ×-Ò-¨dÑ3Ô3Ð3Øˆr   c                óZ   — t           j                             t          d¦  «        ¦  «        S )zN:return: documents directory tied to the user e.g. ``%USERPROFILE%\Documents``ÚCSIDL_PERSONAL©r   r   r   r   r/   s    r   Úuser_documents_dirzWindows.user_documents_dird   s#   € õ Œw×Ò¥Ð/?Ñ @Ô @ÑAÔAÐAr   c                óZ   — t           j                             t          d¦  «        ¦  «        S )zN:return: downloads directory tied to the user e.g. ``%USERPROFILE%\Downloads``ÚCSIDL_DOWNLOADSr@   r/   s    r   Úuser_downloads_dirzWindows.user_downloads_diri   s#   € õ Œw×Ò¥Ð/@Ñ AÔ AÑBÔBÐBr   c                óZ   — t           j                             t          d¦  «        ¦  «        S )zL:return: pictures directory tied to the user e.g. ``%USERPROFILE%\Pictures``ÚCSIDL_MYPICTURESr@   r/   s    r   Úuser_pictures_dirzWindows.user_pictures_dirn   s#   € õ Œw×Ò¥Ð/AÑ BÔ BÑCÔCÐCr   c                óZ   — t           j                             t          d¦  «        ¦  «        S )zH:return: videos directory tied to the user e.g. ``%USERPROFILE%\Videos``ÚCSIDL_MYVIDEOr@   r/   s    r   Úuser_videos_dirzWindows.user_videos_dirs   ó"   € õ Œw×Ò¥¨Ñ ?Ô ?Ñ@Ô@Ð@r   c                óZ   — t           j                             t          d¦  «        ¦  «        S )zF:return: music directory tied to the user e.g. ``%USERPROFILE%\Music``ÚCSIDL_MYMUSICr@   r/   s    r   Úuser_music_dirzWindows.user_music_dirx   rK   r   c                óÀ   — 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   ÚTemp)r   r   r   r$   r   r   r+   s     r   Úuser_runtime_dirzWindows.user_runtime_dir}   sG   € õ Œw×Ò¥¤§¢­^Ð<QÑ-RÔ-RÐTZÑ [Ô [Ñ\Ô\ˆØ×!Ò! $Ñ'Ô'Ð'r   )r   r   )r   r   r   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úpropertyr   r   r,   r0   r3   r6   r8   r:   r=   rA   rD   rG   rJ   rN   rQ   © r   r   r
   r
      s  € € € € € ð
ð 
ð ð(ð (ð (ñ „Xð(ð GKð ð ð ð ð ð ð ð(ð (ð (ñ „Xð(ð
 ð"ð "ð "ñ „Xð"ð ð"ð "ð "ñ „Xð"ð ð?ð ?ð ?ñ „Xð?ð ð?ð ?ð ?ñ „Xð?ð
 ð"ð "ð "ñ „Xð"ð ðð ð ñ „Xðð ðBð Bð Bñ „XðBð ðCð Cð Cñ „XðCð ðDð Dð Dñ „XðDð ðAð Að Añ „XðAð ðAð Að Añ „XðAð ð(ð (ð (ñ „Xð(ð (ð (r   r
   Ú
csidl_namer   r   c                óô   — t          | ¦  «        }|�|S ddddœ                     | ¦  «        }|€d| › �}t          |¦  «        ‚t          j                             |¦  «        }|€d|› �}t          |¦  «        ‚|S )z&Get folder from environment variables.NÚAPPDATAÚALLUSERSPROFILEÚLOCALAPPDATA)r   r)   r   úUnknown CSIDL name: zUnset environment variable: )Ú(get_win_folder_if_csidl_name_not_env_varÚgetÚ
ValueErrorr   Úenviron)rX   ÚresultÚenv_var_nameÚmsgs       r   Úget_win_folder_from_env_varsre   ‡   s˜   € å5°jÑAÔA€FØÐØˆð #Ø 1Ø-ðð ÷ 
‚cˆ*�o„oð	 ð
 ÐØ1 ZÐ1Ð1ˆÝ˜‰oŒoÐÝŒZ�^Š^˜LÑ)Ô)€FØ€~Ø;¨\Ð;Ð;ˆÝ˜‰oŒoÐØ€Mr   r   c                óD  — | dk    rMt           j                             t           j                             t           j        d         ¦  «        d¦  «        S | dk    rMt           j                             t           j                             t           j        d         ¦  «        d¦  «        S | dk    rMt           j                             t           j                             t           j        d         ¦  «        d¦  «        S | dk    rMt           j                             t           j                             t           j        d         ¦  «        d	¦  «        S | d
k    rMt           j                             t           j                             t           j        d         ¦  «        d¦  «        S dS )zKGet folder for a CSIDL name that does not exist as an environment variable.r?   ÚUSERPROFILEÚ	DocumentsrC   Ú	DownloadsrF   ÚPicturesrI   ÚVideosrM   ÚMusicN)r   r   r$   r   ra   )rX   s    r   r^   r^   œ   s"  € àÐ%Ò%Ð%ÝŒw�|Š|�BœG×,Ò,­R¬Z¸Ô-FÑGÔGÈÑUÔUÐUàÐ&Ò&Ð&ÝŒw�|Š|�BœG×,Ò,­R¬Z¸Ô-FÑGÔGÈÑUÔUÐUàÐ'Ò'Ð'ÝŒw�|Š|�BœG×,Ò,­R¬Z¸Ô-FÑGÔGÈÑTÔTÐTà�_Ò$Ð$ÝŒw�|Š|�BœG×,Ò,­R¬Z¸Ô-FÑGÔGÈÑRÔRÐRà�_Ò$Ð$ÝŒw�|Š|�BœG×,Ò,­R¬Z¸Ô-FÑGÔGÈÑQÔQÐQØˆ4r   c           	     ó&  — ddddddddd	œ                      | ¦  «        }|€d| › �}t          |¦  «        ‚t          j        dk    rt          ‚dd
l}|                     |j        d¦  «        }|                     ||¦  «        \  }}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.
    ÚAppDatazCommon AppDatazLocal AppDataÚPersonalz&{374DE290-123F-4565-9164-39C4925E467B}zMy PictureszMy VideozMy Music)r   r)   r   r?   rC   rF   rI   rM   Nr]   Úwin32r   z@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)
r_   r`   ÚsysÚplatformÚNotImplementedErrorÚwinregÚOpenKeyÚHKEY_CURRENT_USERÚQueryValueExr   )rX   Úshell_folder_namerd   rt   ÚkeyÚ	directoryÚ_s          r   Úget_win_folder_from_registryr|   ¯   s²   € ð #Ø 0Ø.Ø$ØCØ)Ø#Ø#ð	ð 	÷ 
‚cˆ*�o„oð ð Ð Ø1 ZÐ1Ð1ˆÝ˜‰oŒoÐÝ
„|�wÒÐÝ!Ð!Ø€M€M€Mà
�.Š.˜Ô1Ð3vÑ
wÔ
w€CØ×&Ò& sÐ,=Ñ>Ô>�L€IˆqÝˆy‰>Œ>Ðr   c           	     óü  — ddddddddd	œ                      | ¦  «        }|€d| › �}t          |¦  «        ‚t          j        d¦  «        }t	          t          d¦  «        }|j                             d
|d
d|¦  «         t          d„ |D ¦   «         ¦  «        r7t          j        d¦  «        }|j         	                    |j
        |d¦  «        r|}| dk    r%t          j                             |j
        d¦  «        S |j
        S )zGet folder with ctypes.é   é#   é   é   é'   é   é   é(   )r   r)   r   r?   rF   rI   rM   rC   Nr]   i   Úwindllr   c              3  ó<   K  — | ]}t          |¦  «        d k    V — ŒdS )éÿ   N)Úord)Ú.0Úcs     r   ú	<genexpr>z,get_win_folder_via_ctypes.<locals>.<genexpr>å   s,   è è € Ð
%Ð
%˜A�3ˆq‰6Œ6�CŠ<Ð
%Ð
%Ð
%Ð
%Ð
%Ð
%r   rC   ri   )r_   r`   ÚctypesÚcreate_unicode_bufferÚgetattrÚshell32ÚSHGetFolderPathWÚanyÚkernel32ÚGetShortPathNameWÚvaluer   r   r$   )rX   Úcsidl_constrd   Úbufr†   Úbuf2s         r   Úget_win_folder_via_ctypesr™   Ì   s  € ð Ø "Ø!ØØØØØð	ð 	÷ 
‚cˆ*�o„oð ð ÐØ1 ZÐ1Ð1ˆÝ˜‰oŒoÐå
Ô
& tÑ
,Ô
,€CÝ•V˜XÑ&Ô&€FØ
„N×#Ò# D¨+°t¸QÀÑDÔDÐDõ Ð
%Ð
% Ð
%Ñ
%Ô
%Ñ%Ô%ð ÝÔ+¨DÑ1Ô1ˆØŒ?×,Ò,¨S¬Y¸¸dÑCÔCð 	ØˆCàÐ&Ò&Ð&ÝŒw�|Š|˜CœI {Ñ3Ô3Ð3àŒ9Ðr   úCallable[[str], str]c                 ó€   — t          t          d¦  «        rt          S 	 dd l} t          S # t
          $ r
 t          cY S w xY w)Nr†   r   )Úhasattrr�   r™   rt   r|   ÚImportErrorre   )rt   s    r   Ú_pick_get_win_folderrž   ð   sY   € Ý�v�xÑ Ô ð )Ý(Ð(ð,Øˆˆˆõ ,Ð+øõ ð ,ð ,ð ,Ý+Ð+Ð+Ð+ð,øøøs   ž) ©=¼=)Úmaxsize)rX   r   r   r   )rX   r   r   r   )r   rš   )rU   Ú
__future__r   r�   r   rq   Ú	functoolsr   Útypingr   Úapir   Úcollections.abcr   r
   re   r^   r|   r™   rž   r   Ú__all__rW   r   r   ú<module>r¦      sW  ðØ €Ø "Ð "Ð "Ð "Ð "Ð "à €€€Ø 	€	€	€	Ø 
€
€
€
Ø Ð Ð Ð Ð Ð Ø  Ð  Ð  Ð  Ð  Ð  à  Ð  Ð  Ð  Ð  Ð  àð )Ø(Ð(Ð(Ð(Ð(Ð(ðt(ð t(ð t(ð t(ð t(ˆoñ t(ô t(ð t(ðnð ð ð ð*ð ð ð ð&ð ð ð ð:!ð !ð !ð !ðH,ð ,ð ,ð ,ð )�� 4Ð(Ñ(Ô(Ð)=Ð)=Ñ)?Ô)?Ñ@Ô@€ð ð€€€r   