From 09c0bbb9bb2cb482a4cb84915c9dda942e7f0555 Mon Sep 17 00:00:00 2001 From: Pablo Emilio Escobar Gaviria Date: Tue, 12 Jan 2021 05:12:44 +1000 Subject: [PATCH] Fixed the previous issues with the histfile and XDG --- mathicsscript/termshell.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mathicsscript/termshell.py b/mathicsscript/termshell.py index be76711..ce8f257 100644 --- a/mathicsscript/termshell.py +++ b/mathicsscript/termshell.py @@ -63,13 +63,15 @@ os.makedirs(CONFIGDIR, exist_ok=True) try: - HISTSIZE = int(os.environ.get("MATHICSSCRIPT_HISTSIZE", 50)) + HISTSIZE = int(os.environ.get("MATHICSSCRIPT_HISTSIZE")) except: HISTSIZE = 50 -# This doesn't work: investigate -# HISTFILE = os.path.join(CONFIGDIR, "history") -HISTFILE = osp.expanduser("~/.mathicsscript_hist") +HISTFILE = os.path.join(CONFIGDIR, "history") + +# Create HISTFILE if it doesn't exist already +if not os.path.isfile(HISTFILE): + pathlib.Path(HISTFILE).touch() RL_COMPLETER_DELIMS_WITH_BRACE = " \t\n_~!@#%^&*()-=+{]}|;:'\",<>/?" RL_COMPLETER_DELIMS = " \t\n_~!@#%^&*()-=+[{]}\\|;:'\",<>/?"