MCPcopy Create free account
hub / github.com/ipython/ipython / get_xdg_dir

Function get_xdg_dir

IPython/utils/path.py:214–230  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

212 'set $HOME environment variable to override' % homedir)
213
214def 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
233def get_xdg_cache_dir():

Callers 1

get_ipython_dirFunction · 0.90

Calls 2

get_home_dirFunction · 0.85
_writable_dirFunction · 0.85

Tested by

no test coverage detected