Skip to content

Commit 9778f74

Browse files
authored
Merge pull request #12 from Mathics3/xdg
Fix the previous issues with the histfile and XDG
2 parents 9e659f7 + 09c0bbb commit 9778f74

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

mathicsscript/termshell.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,15 @@
6363
os.makedirs(CONFIGDIR, exist_ok=True)
6464

6565
try:
66-
HISTSIZE = int(os.environ.get("MATHICSSCRIPT_HISTSIZE", 50))
66+
HISTSIZE = int(os.environ.get("MATHICSSCRIPT_HISTSIZE"))
6767
except:
6868
HISTSIZE = 50
6969

70-
# This doesn't work: investigate
71-
# HISTFILE = os.path.join(CONFIGDIR, "history")
72-
HISTFILE = osp.expanduser("~/.mathicsscript_hist")
70+
HISTFILE = os.path.join(CONFIGDIR, "history")
71+
72+
# Create HISTFILE if it doesn't exist already
73+
if not os.path.isfile(HISTFILE):
74+
pathlib.Path(HISTFILE).touch()
7375

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

0 commit comments

Comments
 (0)