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