%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/xdg/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/xdg/__pycache__/BaseDirectory.cpython-312.pyc

�

�u�cu��t�dZddlZddlZejj	d�Zejjd�xsejjedd�Z	e	gejjd�xsdjd	�zZejjd
�xsejjed�Zegejjd�xsd
jd	�zZ
ejjd�xsejjed�Zejjd�xsejjedd�ZeD�cgc]}|s�|��	c}Ze
D�cgc]}|s�|��	c}Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zdd�Zycc}wcc}w)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��tjj|�}|jd�rJ�tjjt|�}tjj|�stj|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��resourcers  �3/usr/lib/python3/dist-packages/xdg/BaseDirectory.py�save_config_pathr4sa��
�w�w�|�|�X�&�H��"�"�3�'�'�'�
�7�7�<�<���2�D�
�7�7�=�=���
���D�%� ��K�c��tjj|�}|jd�rJ�tjjt|�}tjj|�stj|�|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)rrrr�
xdg_data_homerrrs  r�save_data_pathr@s_��
�w�w�|�|�X�&�H��"�"�3�'�'�'�
�7�7�<�<�
�x�0�D�
�7�7�=�=���
���D���Krc��tjj|�}|jd�rJ�tjjt|�}tjj|�stj|�|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)rrrr�xdg_cache_homerrrs  r�save_cache_pathr!L�_���w�w�|�|�X�&�H��"�"�3�'�'�'�
�7�7�<�<���1�D�
�7�7�=�=���
���D���Krc��tjj|�}|jd�rJ�tjjt|�}tjj|�stj|�|S)z�Ensure ``$XDG_STATE_HOME/<resource>/`` exists, and return its path.
    'resource' should normally be the name of your application or a shared
    resource.r)rrrr�xdg_state_homerrrs  r�save_state_pathr%Wr"rc'��K�tjj|�}tD]F}tjj||�}tjj	|�s�C|���Hy�w)z�Returns an iterator which gives each directory named 'resource' in the
    configuration search path. Information provided by earlier directories should
    take precedence over later ones, and the user-specific config dir comes
    first.N)rrr�xdg_config_dirs�exists)r�
config_dirrs   r�load_config_pathsr*bsQ����
�w�w�|�|�X�&�H�%�,�
��w�w�|�|�J��1��
�7�7�>�>�$��t��,���A%A/�(A/c�$�t|�D]}|cSy)zYReturns the first result from load_config_paths, or None if there is nothing
    to load.N)r*)r�xs  r�load_first_configr.ls ����
)������rc'��K�tjj|�}tD]F}tjj||�}tjj	|�s�C|���Hy�w)z�Returns an iterator which gives each directory named 'resource' in the
    application data search path. Information provided by earlier directories
    should take precedence over later ones.N)rrr�
xdg_data_dirsr()r�data_dirrs   r�load_data_pathsr2ssQ�����w�w�|�|�X�&�H�!�,���w�w�|�|�H�h�/��
�7�7�>�>�$��t��,�r+c��	tjdS#t$�r$|r�ddl}d|j	�z}d}	tj
|�}t
j|j�stj|�d}n�|jtj�k7s.|jtjtjzzrOtj|�d}n7#t$r+}ddl}|j |j"k(rd}n�Yd}~nd}~wwxYw|rtj$|d�|cYSwxYw)aReturns the value of $XDG_RUNTIME_DIR, a directory path.
    
    This directory is intended for 'user-specific non-essential runtime files
    and other file objects (such as sockets, named pipes, ...)', and
    'communication and synchronization purposes'.
    
    As of late 2012, only quite new systems set $XDG_RUNTIME_DIR. If it is not
    set, with ``strict=True`` (the default), a KeyError is raised. With 
    ``strict=False``, PyXDG will create a fallback under /tmp for the current
    user. This fallback does *not* provide the same guarantees as the
    specification requires for the runtime directory.
    
    The strict default is deliberately conservative, so that application
    developers can make a conscious decision to allow the fallback.
    �XDG_RUNTIME_DIRrNz /tmp/pyxdg-runtime-dir-fallback-FTr)r�environ�KeyError�getpass�getuser�lstat�stat�S_ISDIR�st_mode�unlink�st_uid�getuid�S_IRWXG�S_IRWXO�rmdir�OSError�errno�ENOENT�mkdir)�strictr7�fallback�create�st�erDs       r�get_runtime_dirrL|s�� "��z�z�+�,�,��� ����5����8I�I����	����(�#�B��<�<��
�
�+��	�	�(�#����)�)�r�y�y�{�*��*�*����t�|�|� ;�<�����"�����	���w�w�%�,�,�&������	��"��H�H�X�u�%���A �s9��&E�C/�BE�/	D#�8!D�E�D#�#E�E)T)�__doc__rr:r�
expanduser�_homer5�getrr�splitr0rr'r r$rrr!r%r*r.r2rL)r-s0r�<module>rRs����6�
�����3����
�
����/�3��G�G�L�L���'�2�����Z�Z�^�^�O�$�E�(E�L�L�S�Q�R�
��*�*�.�.�!2�3�+��G�G�L�L��	�*��#�#��Z�Z�^�^�%�&�4�*�;�;�C�@�A������� 0�1�*��G�G�L�L���)������� 0�1�3��G�G�L�L���'�2��*�/�q�Q��/�
�-�3���1�3��
�
�	�	�,��,�2��W0��3s�4F0�<F0�F5�F5

Zerion Mini Shell 1.0