File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -35,17 +35,32 @@ 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 if set. We also
39+ evaluate XDG default directory from XDG_CONFIG_HOME environmental variable
40+ if set or its default. Then the old default ~/.tmuxp is returned for
41+ compatibility.
3942
4043 Returns
4144 -------
4245 str :
4346 absolute path to tmuxp config directory
4447 """
45- if 'TMUXP_CONFIGDIR' in os .environ :
46- return os .path .expanduser (os .environ ['TMUXP_CONFIGDIR' ])
4748
48- return os .path .expanduser ('~/.tmuxp/' )
49+ paths = []
50+ if 'TMUXP_CONFIGDIR' in os .environ :
51+ paths .append (os .environ ['TMUXP_CONFIGDIR' ])
52+ if 'XDG_CONFIG_HOME' in os .environ :
53+ paths .append (os .environ ['XDG_CONFIG_HOME' ])
54+ else :
55+ paths .append ('~/.config/tmuxp/' )
56+ paths .append ('~/.tmuxp' )
57+
58+ for path in paths :
59+ path = os .path .expanduser (path )
60+ if os .path .isdir (path ):
61+ return path
62+ # Return last path as default if none of the previous ones matched
63+ return path
4964
5065
5166def get_tmuxinator_dir ():
You can’t perform that action at this time.
0 commit comments