Debian Codegraph @

xdg/__init__.py

raw ◀ ▶
1 Debian patch touch this file
1 __all__ = [ "BaseDirectory", "DesktopEntry", "Menu", "Exceptions", "IniFile", "IconTheme", "Locale", "Config", "Mime", "RecentFiles", "MenuEditor" ]
2
3 __version__ = "0.28"
•4
5 # Compatibility with xdg 5
6
7 from pathlib import Path
8 from typing import Optional, List
9 import os
10
11 from . import BaseDirectory
12
13 def xdg_cache_home() -> Path:
14 return Path(BaseDirectory.xdg_cache_home)
15
16 def xdg_config_dirs() -> List[Path]:
17 return [Path(path) for path in BaseDirectory.xdg_config_dirs]
18
19 def xdg_config_home() -> Path:
20 return Path(BaseDirectory.xdg_config_home)
21
22 def xdg_data_dirs() -> List[Path]:
23 return [Path(path) for path in BaseDirectory.xdg_data_dirs]
24
25 def xdg_data_home() -> Path:
26 return Path(BaseDirectory.xdg_data_home)
27
28 def xdg_runtime_dir() -> Optional[Path]:
29 try:
30 return Path(os.environ['XDG_RUNTIME_DIR'])
31 except KeyError:
32 return None
33
34 XDG_CACHE_HOME = xdg_cache_home()
35 XDG_CONFIG_DIRS = xdg_config_dirs()
36 XDG_CONFIG_HOME = xdg_config_home()
37 XDG_DATA_DIRS = xdg_data_dirs()
38 XDG_DATA_HOME = xdg_data_home()
39 XDG_RUNTIME_DIR = xdg_runtime_dir()