Skip to content

Commit 11e7a60

Browse files
committed
use XDG_CONFIG_HOME/azote as the default directory for azotebg
1 parent 4e77e9d commit 11e7a60

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

azote/tools.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,17 @@ def set_env(language=None):
333333
os.mkdir(common.thumb_dir)
334334

335335
# command file
336-
common.cmd_file = os.path.join(os.getenv("HOME"), ".azotebg")
337-
336+
337+
if os.path.isfile(os.path.join(os.getenv("HOME"), ".azotebg")):
338+
common.cmd_file = os.path.join(os.getenv("HOME"), ".azotebg")
339+
log("~/.azotebg file found", common.INFO)
340+
elif os.path.join(os.getenv("HOME"), ".local/bin") in os.getenv("PATH"):
341+
common.cmd_file = os.path.join(os.getenv("HOME"), ".local/bin/azotebg")
342+
elif os.path.join(os.getenv("HOME"), "bin") in os.getenv("PATH"):
343+
common.cmd_file = os.path.join(os.getenv("HOME"), "bin/azotebg")
344+
else:
345+
common.cmd_file = os.path.join(os.getenv("HOME"), ".azotebg")
346+
log("No valid $PATH location found, using the fallback location", common.INFO)
338347
# temporary folder
339348
common.tmp_dir = os.path.join(common.data_home, "temp")
340349
if not os.path.isdir(common.tmp_dir):

0 commit comments

Comments
 (0)