File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,16 +47,15 @@ def juju_config_dir():
4747 * ~/.local/share/juju
4848
4949 """
50- # Check $JUJU_DATA first
51- config_dir = Path (os .environ .get ('JUJU_DATA' , None ))
52-
53- # Second option: $XDG_DATA_HOME for ~/.local/share
54- if not config_dir .exists ():
55- config_dir = Path (os .environ .get ('XDG_DATA_HOME' , '' )) / 'juju'
56-
57- # Third option: just set it to ~/.local/share/juju
58- if not config_dir .exists ():
59- config_dir = Path ('~/.local/share/juju' )
50+ # Set it to ~/.local/share/juju as default
51+ config_dir = Path ('~/.local/share/juju' )
52+
53+ # Check $JUJU_DATA
54+ if juju_data := os .environ .get ('JUJU_DATA' ):
55+ config_dir = Path (juju_data )
56+ # Secondly check: $XDG_DATA_HOME for ~/.local/share
57+ elif xdg_data_home := os .environ .get ('XDG_DATA_HOME' ):
58+ config_dir = Path (xdg_data_home ) / 'juju'
6059
6160 return str (config_dir .expanduser ().resolve ())
6261
You can’t perform that action at this time.
0 commit comments