Return the XDG_CONFIG_HOME, if it is defined and exists, else None. This is only for non-OS X posix (Linux,Unix,etc.) systems.
()
| 212 | 'set $HOME environment variable to override' % homedir) |
| 213 | |
| 214 | def get_xdg_dir(): |
| 215 | """Return the XDG_CONFIG_HOME, if it is defined and exists, else None. |
| 216 | |
| 217 | This is only for non-OS X posix (Linux,Unix,etc.) systems. |
| 218 | """ |
| 219 | |
| 220 | env = os.environ |
| 221 | |
| 222 | if os.name == 'posix' and sys.platform != 'darwin': |
| 223 | # Linux, Unix, AIX, etc. |
| 224 | # use ~/.config if empty OR not set |
| 225 | xdg = env.get("XDG_CONFIG_HOME", None) or os.path.join(get_home_dir(), '.config') |
| 226 | if xdg and _writable_dir(xdg): |
| 227 | assert isinstance(xdg, str) |
| 228 | return xdg |
| 229 | |
| 230 | return None |
| 231 | |
| 232 | |
| 233 | def get_xdg_cache_dir(): |
no test coverage detected