mirror of
https://github.com/clinton-hall/nzbToMedia.git
synced 2025-08-14 10:36:52 -07:00
Update vendored pyxdg to 0.28
This commit is contained in:
parent
aed4e9261c
commit
5073ec0c6f
7 changed files with 95 additions and 66 deletions
|
@ -43,6 +43,9 @@ xdg_config_dirs = [xdg_config_home] + \
|
|||
xdg_cache_home = os.environ.get('XDG_CACHE_HOME') or \
|
||||
os.path.join(_home, '.cache')
|
||||
|
||||
xdg_state_home = os.environ.get('XDG_STATE_HOME') or \
|
||||
os.path.join(_home, '.local', 'state')
|
||||
|
||||
xdg_data_dirs = [x for x in xdg_data_dirs if x]
|
||||
xdg_config_dirs = [x for x in xdg_config_dirs if x]
|
||||
|
||||
|
@ -81,6 +84,17 @@ def save_cache_path(*resource):
|
|||
os.makedirs(path)
|
||||
return path
|
||||
|
||||
def save_state_path(*resource):
|
||||
"""Ensure ``$XDG_STATE_HOME/<resource>/`` exists, and return its path.
|
||||
'resource' should normally be the name of your application or a shared
|
||||
resource."""
|
||||
resource = os.path.join(*resource)
|
||||
assert not resource.startswith('/')
|
||||
path = os.path.join(xdg_state_home, resource)
|
||||
if not os.path.isdir(path):
|
||||
os.makedirs(path)
|
||||
return path
|
||||
|
||||
def load_config_paths(*resource):
|
||||
"""Returns an iterator which gives each directory named 'resource' in the
|
||||
configuration search path. Information provided by earlier directories should
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue