o
    tBhm                     @   s:   d dl Z d dlmZ ddlmZ G dd deZdgZdS )    N)Path   )PlatformDirsABCc                   @   s   e Zd ZdZedefddZedefddZdedefdd	Zedefd
dZ	edefddZ
edefddZedefddZedefddZedefddZedefddZdedefddZdS )UnixaD  
    On Unix/Linux, we follow the
    `XDG Basedir Spec <https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html>`_. The spec allows
    overriding directories with environment variables. The examples show are the default values, alongside the name of
    the environment variable that overrides them. Makes use of the
    `appname <platformdirs.api.PlatformDirsABC.appname>`,
    `version <platformdirs.api.PlatformDirsABC.version>`,
    `multipath <platformdirs.api.PlatformDirsABC.multipath>`,
    `opinion <platformdirs.api.PlatformDirsABC.opinion>`.
    returnc                 C   ,   t jdd}| st jd}| |S )z
        :return: data directory tied to the user, e.g. ``~/.local/share/$appname/$version`` or
         ``$XDG_DATA_HOME/$appname/$version``
        XDG_DATA_HOME z~/.local/shareosenvirongetstrippath
expanduser_append_app_name_and_versionselfr    r   h/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/platformdirs/unix.pyuser_data_dir      
zUnix.user_data_dirc                 C   s.   t jdd}| sdt j d}| |S )aY  
        :return: data directories shared by users (if `multipath <platformdirs.api.PlatformDirsABC.multipath>` is
         enabled and ``XDG_DATA_DIR`` is set and a multi path the response is also a multi path separated by the OS
         path separator), e.g. ``/usr/local/share/$appname/$version`` or ``/usr/share/$appname/$version``
        XDG_DATA_DIRSr	   z/usr/local/sharez
/usr/share)r   r   r   r   pathsep_with_multi_pathr   r   r   r   site_data_dir   s   
zUnix.site_data_dirr   c                    s<   | tj} js|dd } fdd|D }tj|S )Nr   r   c                    s   g | ]}  tj|qS r   )r   r   r   r   ).0pr   r   r   
<listcomp>/   s    z)Unix._with_multi_path.<locals>.<listcomp>)splitr   r   	multipathjoin)r   r   	path_listr   r   r   r   +   s
   zUnix._with_multi_pathc                 C   r   )z
        :return: config directory tied to the user, e.g. ``~/.config/$appname/$version`` or
         ``$XDG_CONFIG_HOME/$appname/$version``
        XDG_CONFIG_HOMEr	   z	~/.configr
   r   r   r   r   user_config_dir2   r   zUnix.user_config_dirc                 C   s$   t jdd}| sd}| |S )a/  
        :return: config directories shared by users (if `multipath <platformdirs.api.PlatformDirsABC.multipath>`
         is enabled and ``XDG_DATA_DIR`` is set and a multi path the response is also a multi path separated by the OS
         path separator), e.g. ``/etc/xdg/$appname/$version``
        XDG_CONFIG_DIRSr	   z/etc/xdg)r   r   r   r   r   r   r   r   r   site_config_dir=   s   
zUnix.site_config_dirc                 C   r   )z
        :return: cache directory tied to the user, e.g. ``~/.cache/$appname/$version`` or
         ``~/$XDG_CACHE_HOME/$appname/$version``
        XDG_CACHE_HOMEr	   z~/.cacher
   r   r   r   r   user_cache_dirJ   r   zUnix.user_cache_dirc                 C   r   )z
        :return: state directory tied to the user, e.g. ``~/.local/state/$appname/$version`` or
         ``$XDG_STATE_HOME/$appname/$version``
        XDG_STATE_HOMEr	   z~/.local/stater
   r   r   r   r   user_state_dirU   r   zUnix.user_state_dirc                 C   s   | j }| jrtj|d}|S )zx
        :return: log directory tied to the user, same as `user_data_dir` if not opinionated else ``log`` in it
        log)r)   opinionr   r   r"   r   r   r   r   user_log_dir`   s   zUnix.user_log_dirc                 C      |  | jS )zd:return: data path shared by users. Only return first item, even if ``multipath`` is set to ``True``) _first_item_as_path_if_multipathr   r   r   r   r   site_data_pathj      zUnix.site_data_pathc                 C   r/   )zj:return: config path shared by the users. Only return first item, even if ``multipath`` is set to ``True``)r0   r'   r   r   r   r   site_config_patho   r2   zUnix.site_config_path	directoryc                 C   s   | j r|tjd }t|S )Nr   )r!   r    r   r   r   )r   r4   r   r   r   r0   t   s   z%Unix._first_item_as_path_if_multipathN)__name__
__module____qualname____doc__propertystrr   r   r   r%   r'   r)   r+   r.   r   r1   r3   r0   r   r   r   r   r      s,    



	r   )r   pathlibr   apir   r   __all__r   r   r   r   <module>   s    u