
    2 j8                        % S r SSKJr  SSKrSSKrSSKJrJr  SSKJ	r	  \(       a  SSK
Jr  SrS	\S
'    " S S\	5      rS!S jrS"S jrS!S jrSSSSSSSSSSSS.rS\S'   S!S jrS#S jr\" 5       rS!S  jrS/rg)$zWindows.    )annotationsN)TYPE_CHECKINGFinal   )PlatformDirsABC)Callablei @  z
Final[int]_KF_FLAG_DONT_VERIFYc                     \ rS rSrSr\SS j5       rSS.SS jjr\SS j5       r\SS j5       r	\SS	 j5       r
\SS
 j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       rSrg)Windows   a  `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>`.

c                    U R                   (       a  SOSn[        R                  R                  [	        U5      5      nU R                  U5      $ )z:returns: 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      e/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/platformdirs/windows.pyuser_data_dirWindows.user_data_dir   s<     $(<<5Jwwu 56!!$''    Nopinion_valuec                  / nU R                   (       a  U R                  SLa0  U R                  =(       d    U R                   nUR                  U5        UR                  U R                   5        Ub"  U R                  (       a  UR                  U5        U R                  (       a  UR                  U R                  5        [
        R                  R                  " U/UQ76 nU R                  U5        U$ )NF)	appname	appauthorappendopinionversionr   r   join_optionally_create_directory)r   r   r   paramsauthors        r   r   Windows._append_parts#   s    <<~~U*74<<f%MM$,,'(T\\m,||dll+ww||D*6*))$/r   c                t    [         R                  R                  [        S5      5      nU R	                  U5      $ )zU:returns: 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_dirWindows.site_data_dir2   s/     ww/E FG!!$''r   c                    U R                   $ )zD:returns: config directory tied to the user, same as `user_data_dir`r   r   s    r   user_config_dirWindows.user_config_dir8        !!!r   c                    U R                   $ )zC:returns: config directory shared by users, same as `site_data_dir`r-   r1   s    r   site_config_dirWindows.site_config_dir=   r4   r   c                r    [         R                  R                  [        S5      5      nU R	                  USS9$ )z:returns: 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_dirWindows.user_cache_dirB   s4     ww/D EF!!$g!>>r   c                r    [         R                  R                  [        S5      5      nU R	                  USS9$ )ze:returns: cache directory shared by users, e.g. ``C:\ProgramData\$appauthor\$appname\Cache\$version``r*   r:   r   r+   r,   s     r   site_cache_dirWindows.site_cache_dirH   s4     ww/E FG!!$g!>>r   c                    U R                   $ )zC:returns: state directory tied to the user, same as `user_data_dir`r0   r1   s    r   user_state_dirWindows.user_state_dirN   r4   r   c                    U R                   $ )zB:returns: state directory shared by users, same as `site_data_dir`r6   r1   s    r   site_state_dirWindows.site_state_dirS   r4   r   c                    U R                   nU R                  (       a1  [        R                  R	                  US5      nU R                  U5        U$ )zh:returns: 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_dirWindows.user_log_dirX   =     !!<<77<<f-D--d3r   c                    U R                   nU R                  (       a1  [        R                  R	                  US5      nU R                  U5        U$ )zg:returns: log directory shared by users, same as `site_data_dir` if not opinionated else ``Logs`` in itrG   )r-   r"   r   r   r$   r%   r,   s     r   site_log_dirWindows.site_log_dira   rJ   r   c                R    [         R                  R                  [        S5      5      $ )zO:returns: documents directory tied to the user e.g. ``%USERPROFILE%\Documents``CSIDL_PERSONALr   r   r   r   r1   s    r   user_documents_dirWindows.user_documents_dirj        ww/? @AAr   c                R    [         R                  R                  [        S5      5      $ )zO:returns: downloads directory tied to the user e.g. ``%USERPROFILE%\Downloads``CSIDL_DOWNLOADSrP   r1   s    r   user_downloads_dirWindows.user_downloads_diro   s     ww/@ ABBr   c                R    [         R                  R                  [        S5      5      $ )zM:returns: pictures directory tied to the user e.g. ``%USERPROFILE%\Pictures``CSIDL_MYPICTURESrP   r1   s    r   user_pictures_dirWindows.user_pictures_dirt   s     ww/A BCCr   c                R    [         R                  R                  [        S5      5      $ )zI:returns: videos directory tied to the user e.g. ``%USERPROFILE%\Videos``CSIDL_MYVIDEOrP   r1   s    r   user_videos_dirWindows.user_videos_diry        ww ?@@r   c                R    [         R                  R                  [        S5      5      $ )zG:returns: music directory tied to the user e.g. ``%USERPROFILE%\Music``CSIDL_MYMUSICrP   r1   s    r   user_music_dirWindows.user_music_dir~   r`   r   c                R    [         R                  R                  [        S5      5      $ )zL:returns: desktop directory tied to the user, e.g. ``%USERPROFILE%\Desktop``CSIDL_DESKTOPDIRECTORYrP   r1   s    r   user_desktop_dirWindows.user_desktop_dir   s     ww/G HIIr   c                    [         R                  R                  [         R                  R                  [	        S5      S5      5      $ )zJ:returns: bin directory tied to the user, e.g. ``%LOCALAPPDATA%\Programs``r   Programsr   r   r   r$   r   r1   s    r   user_bin_dirWindows.user_bin_dir   s/     ww^<Q-RT^ _``r   c                    [         R                  R                  [         R                  R                  [	        S5      S5      5      $ )zC:returns: bin directory shared by users, e.g. ``C:\ProgramDatain``r*   binrk   r1   s    r   site_bin_dirWindows.site_bin_dir   s/     ww^<R-SUZ [\\r   c                R    [         R                  R                  [        S5      5      $ )zO:returns: applications directory tied to the user, e.g. ``Start Menu\Programs``CSIDL_PROGRAMSrP   r1   s    r   user_applications_dirWindows.user_applications_dir   rS   r   c                R    [         R                  R                  [        S5      5      $ )zo:returns: applications directory shared by users, e.g. ``C:\ProgramData\Microsoft\Windows\Start Menu\Programs``CSIDL_COMMON_PROGRAMSrP   r1   s    r   site_applications_dirWindows.site_applications_dir   s     ww/F GHHr   c                    [         R                  R                  [         R                  R                  [	        S5      S5      5      nU R                  U5      $ )zk:returns: 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_dirWindows.user_runtime_dir   s?     ww^<Q-RTZ [\!!$''r   c                    U R                   $ )zG:returns: runtime directory shared by users, same as `user_runtime_dir`)r|   r1   s    r   site_runtime_dirWindows.site_runtime_dir   s     $$$r    )returnstr)r   r   r   
str | Noner   r   )__name__
__module____qualname____firstlineno____doc__propertyr   r   r-   r2   r7   r;   r>   rA   rD   rH   rL   rQ   rV   rZ   r^   rc   rg   rl   rp   rt   rx   r|   r   __static_attributes__r   r   r   r   r      s    ( ( GK  ( (
 " " " " ? ?
 ? ?
 " " " "     B B C C D D A A A A J J a a ] ] B B I I ( (
 % %r   r   c                    [        U 5      nUb  U$ SSSS.R                  U 5      nUc  SU  3n[        U5      e[        R                  R                  U5      nUc  SU 3n[        U5      eU$ )z&Get folder from environment variables.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)
csidl_nameresultenv_var_namemsgs       r   get_win_folder_from_env_varsr      s    5jAF # 1- 
c*o	 
 $ZL1oZZ^^L)F~,\N;oMr   c                   U S:X  aN  [         R                  R                  [         R                  R                  [         R                  S   5      S5      $ U S:X  aN  [         R                  R                  [         R                  R                  [         R                  S   5      S5      $ U S:X  aN  [         R                  R                  [         R                  R                  [         R                  S   5      S5      $ U S:X  aN  [         R                  R                  [         R                  R                  [         R                  S   5      S	5      $ U S
:X  aN  [         R                  R                  [         R                  R                  [         R                  S   5      S5      $ U S:X  aQ  [         R                  R                  [         R                  R                  [         R                  S   5      SSSS5      $ U S:X  a|  [         R                  R                  [         R                  R                  [         R                  R                  S[         R                  R                  SS5      5      5      SSSS5      $ g)zMGet a folder for a CSIDL name that does not exist as an environment variable.rO   USERPROFILE	DocumentsrU   	DownloadsrY   Picturesr]   Videosrb   Musicrs   r   	Microsoftr   z
Start Menurj   rw   PROGRAMDATAr   zC:\ProgramDataN)r   r   r$   r   r   r   )r   s    r   r   r      s   %%ww||BGG,,RZZ-FGUU&&ww||BGG,,RZZ-FGUU''ww||BGG,,RZZ-FGTT_$ww||BGG,,RZZ-FGRR_$ww||BGG,,RZZ-FGQQ%%ww||GGRZZ	23
 	
 ,,ww||GGRZZ^^M2::>>J[]n;opq
 	
 r   c                >   SS1nSSSSSSS	S
SSS.
R                  U 5      nUc  SU  3n[        U5      e[        R                  S:w  a  [        eSSKnX;   a  UR                  OUR                  nUR                  US5      nUR                  Xb5      u  px[        U5      $ )zGet 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.

r*   rw   AppDatazCommon AppDatazLocal AppDataPersonal&{374DE290-123F-4565-9164-39C4925E467B}zMy PictureszMy VideozMy Musicrj   zCommon Programs)
r   r*   r   rO   rU   rY   r]   rb   rs   rw   Nr   win32r   z@Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders)r   r   sysplatformNotImplementedErrorwinregHKEY_LOCAL_MACHINEHKEY_CURRENT_USEROpenKeyQueryValueExr   )	r   machine_namesshell_folder_namer   r   hkeykey	directory_s	            r   get_win_folder_from_registryr      s     	M
 # 0.$C)##$!2 
c*o   $ZL1o
||w!! )3(C6$$IaIaD
..b
cC&&s>LIy>r   z&{3EB685DB-65F9-4CF6-A03A-E3EF65729F3D}z&{62AB5D82-FDC1-4DC3-A9DD-070D1D495D97}z&{F1B32785-6FBA-4FCF-9D55-7B8E7F157091}z&{FDD39AD0-238F-46AF-ADB4-6C85480369C7}z&{33E28130-4E1E-4676-835A-98395C3BC3BB}z&{18989B1D-99B5-455B-841C-AB7C74E4DDFC}z&{4BD8D571-6D19-48D3-BE97-422220080E43}r   z&{B4BFCC3A-DB2C-424C-B029-7FE99A87C641}z&{A77F5D77-2E2B-44C3-A6A2-ABA601054A51}z&{0139D44E-6AFE-49F2-8690-3DAFCAE6FFB8})r   r*   r   rO   rY   r]   rb   rU   rf   rs   rw   zdict[str, str]_KNOWN_FOLDER_GUIDSc                ~  ^ [         R                  S:w  a  [        eSSKJnJnJnJnJnJ	nJ
m   " U4S jSU5      nU" S5      nXR                  l        TR                  U" U5      /UR                  l        SUR                  l        TR                   /UR                  l        U" S5      n	XR"                  l        U" U5      TR$                  TR&                  U" TR(                  5      /U	R"                  l        U" S	5      n
TR$                  U
R*                  l        TR(                  TR(                  TR$                  /U
R*                  l        [,        R/                  U 5      nUc  S
U  3n[1        U5      eU" 5       nUR                  X" U5      5        TR)                  5       nU	R#                  U" U5      [2        SU" U5      5        UR4                  nUR                  U5        Uc  SU  3n[1        U5      e[7        S U 5       5      (       a,  U" S5      nU
R+                  UUS5      (       a  UR4                  nU$ )zGet folder via :func:`SHGetKnownFolderPath`.

See https://learn.microsoft.com/en-us/windows/win32/api/shlobj_core/nf-shlobj_core-shgetknownfolderpath.

r   r   )HRESULTPOINTER	StructureWinDLLbyrefcreate_unicode_bufferwintypesc                     > \ rS rSrS Y R                  4S Y R
                  4S Y R
                  4S Y R                  S-  4/rSrg)	(get_win_folder_via_ctypes.<locals>._GUIDi!  Data1Data2Data3Data4   r   N)	r   r   r   r   DWORDWORDBYTE_fields_r   )r   s   r   _GUIDr   !  s?    hnn%hmm$hmm$hmma'(	
r   r   ole32Nshell32kernel32r   z'SHGetKnownFolderPath returned NULL for c              3  >   #    U  H  n[        U5      S :  v   M     g7f)   N)ord).0cs     r   	<genexpr>,get_win_folder_via_ctypes.<locals>.<genexpr>H  s     
(A3q6C<s   i   )r   r   r   ctypesr   r   r   r   r   r   r   CLSIDFromStringrestype	LPCOLESTRargtypesCoTaskMemFreeLPVOIDSHGetKnownFolderPathr   HANDLELPWSTRGetShortPathNameWr   r   r   r	   valueany)r   r   r   r   r   r   r   r   r   r   r   folder_guidr   guidpath_ptrr   bufr   s                    @r   get_win_folder_via_ctypesr     s    ||w!!bbb
	 
 7OE$+!&.&8&8'%.%IE""&E$,OO#4E YG+2  (-4U^X^^X__^efnfufu^v,wG  )j!H)1H&+3??HOOX^^*\H'%))*5K$ZL1o7D	+uT{3 H  t.BD%PX/Z^^F	!~7
|Do

(
(((#D)%%fc488YYFMr   c                 z     SSK n [        $ ! [         a     Of = f SSKn[        $ ! [         a	    [
        s $ f = f)zjSelect the best method to resolve Windows folder paths: ctypes, then registry, then environment variables.r   N)r   r   ImportErrorr   r   r   )r   r   s     r   _pick_get_win_folderr   P  sM    ) )(  , ,+  ,++,s    
' ::c                    SU R                  S5       3n[        R                  R                  US5      R	                  5       =n(       a  U$ [        U 5      $ )zGet a Windows folder path, checking for ``WIN_PD_OVERRIDE_*`` environment variable overrides first.

For example, ``CSIDL_LOCAL_APPDATA`` can be overridden by setting ``WIN_PD_OVERRIDE_LOCAL_APPDATA``.

WIN_PD_OVERRIDE_CSIDL_ )removeprefixr   r   r   strip_resolve_win_folder)r   env_varoverrides      r   r   r   c  sO     !!8!8!B CDG::>>'2.4466x6z**r   )r   r   r   r   )r   r   r   r   )r   zCallable[[str], str])r   
__future__r   r   r   typingr   r   apir   collections.abcr   r	   __annotations__r   r   r   r   r   r   r   r   r   __all__r   r   r   <module>r      s     " 	 
 '  ( $. j -S%o S%l*"J#N >DC>@==?F>E' ^ 6r,  +, 	+ r   