
    li                        d Z ddlmZ ddlZddlZddlmZ er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 G d dee      ZdgZy)zmacOS.    )annotationsN)TYPE_CHECKING)Iterator   )XDGMixin)PlatformDirsABC)Pathc                     e Zd Z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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!dZd!dZy)"_MacOSDefaultsa  Default platform directories for macOS without XDG environment variable overrides.

    Follows the guidance from `Apple's File System Programming Guide
    <https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html>`_.
    The XDG env var handling is in :class:`~platformdirs._xdg.XDGMixin`.

    c                ^    | j                  t        j                  j                  d            S )zc:returns: data directory tied to the user, e.g. ``~/Library/Application Support/$appname/$version``z~/Library/Application Support_append_app_name_and_versionospath
expanduserselfs    N/mnt/e/genesis-system/.venv/lib/python3.12/site-packages/platformdirs/macos.pyuser_data_dirz_MacOSDefaults.user_data_dir   s%     001C1CDc1dee    c                    dt         j                  v }|r"t         j                  j                  d      d   nd}|r| j                  | d      gng }|j	                  | j                  d             |S )N/opt/pythonr    z/sharez/Library/Application Support)sysprefixsplitr   appendr   is_homebrewhomebrew_prefix	path_lists       r   _site_data_dirsz_MacOSDefaults._site_data_dirs!   sn    #szz1@K#****=9!<QSWbT66/9J&7QRShj	::;YZ[r   c                8    | j                  | j                        S )zi:returns: data path shared by users. Only return the first item, even if ``multipath`` is set to ``True``) _first_item_as_path_if_multipathsite_data_dirr   s    r   site_data_pathz_MacOSDefaults.site_data_path)   s     44T5G5GHHr   c                    | j                   S )zD:returns: config directory tied to the user, same as `user_data_dir`r   r   s    r   user_config_dirz_MacOSDefaults.user_config_dir.        !!!r   c                    | j                   S )N)r"   r   s    r   _site_config_dirsz _MacOSDefaults._site_config_dirs3   s    ###r   c                ^    | j                  t        j                  j                  d            S )zW:returns: cache directory tied to the user, e.g. ``~/Library/Caches/$appname/$version``z~/Library/Cachesr   r   s    r   user_cache_dirz_MacOSDefaults.user_cache_dir7   s%     001C1CDV1WXXr   c                D   dt         j                  v }|r"t         j                  j                  d      d   nd}|r| j                  | d      gng }|j	                  | j                  d             | j
                  rt        j                  j                  |      S |d   S )a  :returns: cache directory shared by users, e.g. ``/Library/Caches/$appname/$version``. If we're using a Python binary managed by `Homebrew <https://brew.sh>`_, the directory will be under the Homebrew prefix, e.g. ``$homebrew_prefix/var/cache/$appname/$version``. If `multipath <platformdirs.api.PlatformDirsABC.multipath>` is enabled, and we're in Homebrew, the response is a multi-path string separated by ":", e.g. ``$homebrew_prefix/var/cache/$appname/$version:/Library/Caches/$appname/$version``r   r   r   z
/var/cachez/Library/Caches)	r   r   r   r   r   	multipathr   pathsepjoinr   s       r   site_cache_dirz_MacOSDefaults.site_cache_dir<   s     $szz1@K#****=9!<QS[fT66/9J*7UVWln	::;LMN>>::??9--|r   c                8    | j                  | j                        S )zj:returns: cache path shared by users. Only return the first item, even if ``multipath`` is set to ``True``)r$   r3   r   s    r   site_cache_pathz_MacOSDefaults.site_cache_pathG   s     44T5H5HIIr   c                    | j                   S )zC:returns: state directory tied to the user, same as `user_data_dir`r(   r   s    r   user_state_dirz_MacOSDefaults.user_state_dirL   r*   r   c                    | j                   S )zB:returns: state directory shared by users, same as `site_data_dir`)r%   r   s    r   site_state_dirz_MacOSDefaults.site_state_dirQ   r*   r   c                ^    | j                  t        j                  j                  d            S )zS:returns: log directory tied to the user, e.g. ``~/Library/Logs/$appname/$version``z~/Library/Logsr   r   s    r   user_log_dirz_MacOSDefaults.user_log_dirV   s%     001C1CDT1UVVr   c                $    | j                  d      S )zQ:returns: log directory shared by users, e.g. ``/Library/Logs/$appname/$version``z/Library/Logs)r   r   s    r   site_log_dirz_MacOSDefaults.site_log_dir[   s     00AAr   c                @    t         j                  j                  d      S )zD:returns: documents directory tied to the user, e.g. ``~/Documents``z~/Documentsr   r   r   r   s    r   user_documents_dirz!_MacOSDefaults.user_documents_dir`        ww!!-00r   c                @    t         j                  j                  d      S )zD:returns: downloads directory tied to the user, e.g. ``~/Downloads``z~/Downloadsr?   r   s    r   user_downloads_dirz!_MacOSDefaults.user_downloads_dire   rA   r   c                @    t         j                  j                  d      S )zB:returns: pictures directory tied to the user, e.g. ``~/Pictures``z
~/Picturesr?   r   s    r   user_pictures_dirz _MacOSDefaults.user_pictures_dirj   s     ww!!,//r   c                @    t         j                  j                  d      S )z>:returns: videos directory tied to the user, e.g. ``~/Movies``z~/Moviesr?   r   s    r   user_videos_dirz_MacOSDefaults.user_videos_diro   s     ww!!*--r   c                @    t         j                  j                  d      S )z<:returns: music directory tied to the user, e.g. ``~/Music``z~/Musicr?   r   s    r   user_music_dirz_MacOSDefaults.user_music_dirt   s     ww!!),,r   c                @    t         j                  j                  d      S )z@:returns: desktop directory tied to the user, e.g. ``~/Desktop``z	~/Desktopr?   r   s    r   user_desktop_dirz_MacOSDefaults.user_desktop_diry   s     ww!!+..r   c                @    t         j                  j                  d      S )z?:returns: bin directory tied to the user, e.g. ``~/.local/bin``z~/.local/binr?   r   s    r   user_bin_dirz_MacOSDefaults.user_bin_dir~   s     ww!!.11r   c                     y)z@:returns: bin directory shared by users, e.g. ``/usr/local/bin``z/usr/local/bin r   s    r   site_bin_dirz_MacOSDefaults.site_bin_dir   s      r   c                @    t         j                  j                  d      S )zJ:returns: applications directory tied to the user, e.g. ``~/Applications``z~/Applicationsr?   r   s    r   user_applications_dirz$_MacOSDefaults.user_applications_dir   s     ww!!"233r   c                    dgS )Nz/ApplicationsrO   r   s    r   _site_applications_dirsz&_MacOSDefaults._site_applications_dirs   s      r   c                z    | j                   }| j                  rt        j                  j	                  |      S |d   S )zH:returns: applications directory shared by users, e.g. ``/Applications``r   )rT   r0   r   r1   r2   )r   dirss     r   site_applications_dirz$_MacOSDefaults.site_applications_dir   s1     ++(,rzzt$CDGCr   c                ^    | j                  t        j                  j                  d            S )zh:returns: runtime directory tied to the user, e.g. ``~/Library/Caches/TemporaryItems/$appname/$version``z~/Library/Caches/TemporaryItemsr   r   s    r   user_runtime_dirz_MacOSDefaults.user_runtime_dir   s%     001C1CDe1fggr   c                    | j                   S )zG:returns: runtime directory shared by users, same as `user_runtime_dir`)rY   r   s    r   site_runtime_dirz_MacOSDefaults.site_runtime_dir   s     $$$r   c              #  T   K   | j                    | j                  E d{    y7 w)z4:yield: all user and site configuration directories.N)r)   r,   r   s    r   iter_config_dirsz_MacOSDefaults.iter_config_dirs   s!     """))))   (&(c              #  T   K   | j                    | j                  E d{    y7 w)z+:yield: all user and site data directories.N)r   r"   r   s    r   iter_data_dirsz_MacOSDefaults.iter_data_dirs   s!        ''''r^   N)returnstr)ra   z	list[str])ra   r	   )ra   zIterator[str]) __name__
__module____qualname____doc__propertyr   r"   r&   r)   r,   r.   r3   r5   r7   r9   r;   r=   r@   rC   rE   rG   rI   rK   rM   rP   rR   rT   rW   rY   r[   r]   r`   rO   r   r   r   r      s    f f   I I " " $ $ Y Y   J J " " " " W W B B 1 1 1 1 0 0 . . - - / / 2 2     4 4 ! ! D D
 h h % %*
(r   r   c                      e Zd ZdZy)MacOSaF  Platform directories for the macOS operating system.

    Follows the guidance from `Apple documentation
    <https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html>`_.
    Makes use of the `appname <platformdirs.api.PlatformDirsABC.appname>`, `version
    <platformdirs.api.PlatformDirsABC.version>`, `ensure_exists <platformdirs.api.PlatformDirsABC.ensure_exists>`.

    XDG environment variables (e.g. ``$XDG_DATA_HOME``) are supported and take precedence over macOS defaults.

    N)rc   rd   re   rf   rO   r   r   ri   ri      s    	r   ri   )rf   
__future__r   os.pathr   r   typingr   collections.abcr   _xdgr   apir   pathlibr	   r   ri   __all__rO   r   r   <module>rr      sO     "  
  (   V(_ V(r
Hn 
 r   