o
    a                     @   s|   d dl Z d dlZd dlZdd Zdd Zdd Zdd	 ZeZd
d Zdd Z	e
 de  eZe
 de  e	ZdS )    Nc                   C   s   t jt jd dS )NUSERPROFILEzLocal Settings)ospathjoinenviron r   r   8/usr/lib/python3/dist-packages/keyring/util/platform_.py_settings_root_XP   s   r	   c                   C   s   t jdt jddS )NLOCALAPPDATAProgramData.)r   r   getr   r   r   r   _settings_root_Vista
   s   r   c                  C   s2   t  \} }}}| dkrt nt }tj|dS )NXPzPython Keyring)platform	win32_verr	   r   r   r   r   )releaseversioncsdptyperootr   r   r   _data_root_Windows   s   r   c                  C   s.   t j d } tjddp| }tj|dS )zW
    Use freedesktop.org Base Dir Specification to determine storage
    location.
    z.local/shareXDG_DATA_HOMENpython_keyring)pathlibPathhomer   r   r   r   r   )fallbackr   r   r   r   _data_root_Linux   s   r   c                  C   sh   dd t  d< tjt d} tjt d}tj|r0tj| s2d| d|  d}t|dS dS )	a  
    Prior versions of keyring would search for the config
    in XDG_DATA_HOME, but should probably have been
    searching for config in XDG_CONFIG_HOME. If the
    config exists in the former but not in the latter,
    raise a RuntimeError to force the change.
    c                   S   s   d S )Nr   r   r   r   r   <lambda>*   s    z(_check_old_config_root.<locals>.<lambda>_check_old_config_rootzkeyringrc.cfgz/Keyring config exists only in the old location z and should be moved to z& to work with this version of keyring.N)globalsr   r   r   _config_root_Linuxr   isfileRuntimeError)config_file_newconfig_file_oldmsgr   r   r   r    !   s   	r    c                  C   s8   t   tj d } d}tj|dp| }tj|dS )zV
    Use freedesktop.org Base Dir Specification to determine config
    location.
    z.configXDG_CONFIG_HOMENr   )	r    r   r   r   r   r   r   r   r   )r   keyr   r   r   r   r"   6   s
   r"   _data_root__config_root)r   r   r   r	   r   r   r   _config_root_Windowsr    r"   r!   r   system	data_rootconfig_rootr   r   r   r   <module>   s    
