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    
