Skip to content

Commit 950e88c

Browse files
committed
Confirm environment variables are empty before appending them.
1 parent ceec5f8 commit 950e88c

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tmuxp/cli.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ def get_config_dir():
3535
"""
3636
Return tmuxp configuration directory.
3737
38-
``TMUXP_CONFIGDIR`` environmental variable has precedence, then XDG default
39-
directory is checked, either from XDG_CONFIG_HOME environmental variable or
40-
its default, then the old default ~/.tmuxp is returned for compatibility.
38+
``TMUXP_CONFIGDIR`` environmental variable has precedence if set and not
39+
empty. We also honor XDG default directory, evaluating from XDG_CONFIG_HOME
40+
environmental variable if set and not empty or its default. Then the old
41+
default ~/.tmuxp is returned for compatibility.
4142
4243
Returns
4344
-------
@@ -46,9 +47,9 @@ def get_config_dir():
4647
"""
4748

4849
paths = []
49-
if 'TMUXP_CONFIGDIR' in os.environ:
50+
if 'TMUXP_CONFIGDIR' in os.environ and os.environ['TMUX_CONFIGDIR']:
5051
paths.append(os.environ['TMUXP_CONFIGDIR'])
51-
if 'XDG_CONFIG_HOME' in os.environ:
52+
if 'XDG_CONFIG_HOME' in os.environ and os.environ['XDG_CONFIG_HOME']:
5253
paths.append(os.environ['XDG_CONFIG_HOME'])
5354
else:
5455
paths.append('~/.config/tmuxp/')

0 commit comments

Comments
 (0)