Skip to content

Commit 8cad89e

Browse files
authored
Merge pull request #5 from Mathics3/xdg
Made mathicsscript XDG compatible
2 parents ab58b65 + 6d80685 commit 8cad89e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

mathicsscript/termshell.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,17 @@
5555
write_history_file,
5656
)
5757

58+
# Set up mathicsscript configuration directory
59+
CONFIGHOME = os.environ.get("XDG_CONFIG_HOME", osp.expanduser("~/.config"))
60+
CONFIGDIR = os.path.join(CONFIGHOME, "mathicsscript")
61+
os.makedirs(CONFIGDIR, exist_ok=True)
62+
5863
try:
5964
HISTSIZE = int(os.environ.get("MATHICSSCRIPT_HISTSIZE", 50))
6065
except:
6166
HISTSIZE = 50
6267

63-
HISTFILE = osp.expanduser("~/.mathicsscript_hist")
68+
HISTFILE = os.path.join(CONFIGDIR, "history")
6469

6570
RL_COMPLETER_DELIMS_WITH_BRACE = " \t\n_~!@#%^&*()-=+{]}|;:'\",<>/?"
6671
RL_COMPLETER_DELIMS = " \t\n_~!@#%^&*()-=+[{]}\\|;:'\",<>/?"

0 commit comments

Comments
 (0)