File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -35,17 +35,31 @@ def get_config_dir():
3535 """
3636 Return tmuxp configuration directory.
3737
38- Checks for ``TMUXP_CONFIGDIR`` environmental variable.
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.
3941
4042 Returns
4143 -------
4244 str :
4345 absolute path to tmuxp config directory
4446 """
45- if 'TMUXP_CONFIGDIR' in os .environ :
46- return os .path .expanduser (os .environ ['TMUXP_CONFIGDIR' ])
4747
48- return os .path .expanduser ('~/.tmuxp/' )
48+ paths = []
49+ if 'TMUXP_CONFIGDIR' in os .environ :
50+ paths .append (os .environ ['TMUXP_CONFIGDIR' ])
51+ if 'XDG_CONFIG_HOME' in os .environ :
52+ paths .append (os .environ ['XDG_CONFIG_HOME' ])
53+ else :
54+ paths .append ('~/.config/tmuxp/' )
55+ paths .append ('~/.tmuxp' )
56+
57+ for path in paths :
58+ path = os .path .expanduser (path )
59+ if os .path .isdir (path ):
60+ return path
61+ # Return last path as default if none of the previous ones matched
62+ return path
4963
5064
5165def get_tmuxinator_dir ():
You can’t perform that action at this time.
0 commit comments