Mini Shell
3
�Y�]~ � @ s d Z ddlZddlZejjd�Zejjd�p:ejjedd�Z e gejjd�pNdj
d � Zejjd
�ppejjed�Zegejjd�p�d
j
d � Z
ejjd�p�ejjed�Zdd� eD �Zdd� e
D �Z
dd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd"d d!�ZdS )#a
This module is based on a rox module (LGPL):
http://cvs.sourceforge.net/viewcvs.py/rox/ROX-Lib2/python/rox/basedir.py?rev=1.9&view=log
The freedesktop.org Base Directory specification provides a way for
applications to locate shared data and configuration:
http://standards.freedesktop.org/basedir-spec/
(based on version 0.6)
This module can be used to load and save from and to these directories.
Typical usage:
from rox import basedir
for dir in basedir.load_config_paths('mydomain.org', 'MyProg', 'Options'):
print "Load settings from", dir
dir = basedir.save_config_path('mydomain.org', 'MyProg')
print >>file(os.path.join(dir, 'Options'), 'w'), "foo=2"
Note: see the rox.Options module for a higher-level API for managing options.
� N�~Z
XDG_DATA_HOMEz.localZshareZ
XDG_DATA_DIRSz/usr/local/share:/usr/share�:ZXDG_CONFIG_HOMEz.configZXDG_CONFIG_DIRSz/etc/xdgZXDG_CACHE_HOMEz.cachec C s g | ]}|r|�qS � r )�.0�xr r �#/usr/lib/python3.6/BaseDirectory.py�
<listcomp>. s r c C s g | ]}|r|�qS r r )r r r r r r / s c G s6 t jj| � } t jjt| �}t jj|�s2t j|d� |S )z�Ensure ``$XDG_CONFIG_HOME/<resource>/`` exists, and return its path.
'resource' should normally be the name of your application. Use this
when saving configuration settings.
i� )�os�path�join�xdg_config_home�isdir�makedirs)�resourcer
r r r �save_config_path1 s
r c G s4 t jj| � } t jjt| �}t jj|�s0t j|� |S )z�Ensure ``$XDG_DATA_HOME/<resource>/`` exists, and return its path.
'resource' should normally be the name of your application or a shared
resource. Use this when saving or updating application data.
)r r
r �
xdg_data_homer
r )r r
r r r �save_data_path= s
r c G s4 t jj| � } t jjt| �}t jj|�s0t j|� |S )z�Ensure ``$XDG_CACHE_HOME/<resource>/`` exists, and return its path.
'resource' should normally be the name of your application or a shared
resource.)r r
r �xdg_cache_homer
r )r r
r r r �save_cache_pathI s
r c g s>