← Back
Editing: BaseDirectory.cpython-311.pyc
� �u�cu � �( � d Z ddlZddlZej � d� � Zej � d� � pej � edd� � Z e gej � d� � pd� d � � z Zej � d � � pej � ed� � Zegej � d� � pd � d � � z Z ej � d� � pej � ed� � Zej � d� � pej � edd� � Zd� eD � � Zd� e D � � Z d� Zd� Zd� Zd� Zd� Zd� Zd� Zdd�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�~� XDG_DATA_HOMEz.local�share� XDG_DATA_DIRSz/usr/local/share:/usr/share�:�XDG_CONFIG_HOMEz.config�XDG_CONFIG_DIRSz/etc/xdg�XDG_CACHE_HOMEz.cache�XDG_STATE_HOME�statec � � g | ]}|�|��S � r ��.0�xs �3/usr/lib/python3/dist-packages/xdg/BaseDirectory.py� <listcomp>r 1 s � �/�/�/�q�Q�/��/�/�/� c � � g | ]}|�|��S r r r s r r r 2 s � �3�3�3���3�1�3�3�3r c � � t j j | � } | � d� � rJ �t j � t | � � }t j � |� � st 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. �/� )�os�path�join� startswith�xdg_config_home�isdir�makedirs��resourcer s r �save_config_pathr"