link-grammar icon indicating copy to clipboard operation
link-grammar copied to clipboard

Stop litering `.lg_history` in current directory.

Open linas opened this issue 2 years ago • 7 comments

Currently, this line:

https://github.com/opencog/link-grammar/blob/af7033e541160a0d0b941d9ed70c7dff7f979361/link-parser/lg_readline.c#L375

causes the .lg_history file to be written in the current working directory, resulting in LG litter everywhere. It's getting annoying. It should be changed to either ~/.lg_history or to ~/.cache/link-grammar/lg_history

I tried changing it to ~/.lg_history but that did not work. Seems that history_w(hist, &ev, H_LOAD, HFILE); does not know what to do with the tilde. And, at any rate, this won't work in windows, anyway. So I'm opening this bug report instead ...

linas avatar Feb 21 '23 00:02 linas

There is a function expand_homedir() in parser-utilities.h. There is a comment there:

 * Note: ~user is not supported here on Windows.

However, it seems this is a comment rot since the code seem to support Windows (and 54f672357f46a6f1b37feb3159054592e896368b says I tested it).

ampli avatar Feb 21 '23 00:02 ampli

Cool, thanks, I'll trying hacking that up, unless you want to do it.

linas avatar Feb 21 '23 00:02 linas

Please do it, because I'm preparing yet some other PRs just now.

ampli avatar Feb 21 '23 01:02 ampli

Fixed, in #1446 for Linux only. I'm leaving this open, for Windows and Apple. Should be easy; just .. different #defines, right?

linas avatar Feb 21 '23 04:02 linas

Closing because resolved in #1447.

linas avatar Feb 21 '23 04:02 linas

Closed wrong issue.

linas avatar Feb 21 '23 04:02 linas

See comments in #1446 for current status

linas avatar Feb 22 '23 00:02 linas

I have just submitted PR #1534 - XDG-base-directory implementation that has per-dict history.

ampli avatar May 24 '24 13:05 ampli