Skip to content

Commit

Permalink
Use getenv
Browse files Browse the repository at this point in the history
  • Loading branch information
noiioiu committed Nov 17, 2024
1 parent 26419cc commit 2ea0206
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions confuse/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,12 @@ def find_package_path(name):

def xdg_config_home():
"""Returns the value of XDG_CONFIG_HOME environment
variable if it exists and is an absolute path,
and UNIX_DIR_FALLBACK otherwise
variable if it exists and is an absolute path, and
UNIX_DIR_FALLBACK otherwise
"""
if 'XDG_CONFIG_HOME' in os.environ and os.path.isabs(os.environ['XDG_CONFIG_HOME']):
return os.environ['XDG_CONFIG_HOME']
config_dir = os.getenv('XDG_CONFIG_HOME', UNIX_DIR_FALLBACK)
if os.path.isabs(config_dir):
return config_dir
else:
return UNIX_DIR_FALLBACK

Expand Down

0 comments on commit 2ea0206

Please sign in to comment.