File tree 1 file changed +18
-4
lines changed
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():
35
35
"""
36
36
Return tmuxp configuration directory.
37
37
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.
39
41
40
42
Returns
41
43
-------
42
44
str :
43
45
absolute path to tmuxp config directory
44
46
"""
45
- if 'TMUXP_CONFIGDIR' in os .environ :
46
- return os .path .expanduser (os .environ ['TMUXP_CONFIGDIR' ])
47
47
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
49
63
50
64
51
65
def get_tmuxinator_dir ():
You can’t perform that action at this time.
0 commit comments