From 6f1f41ffe3283a0bbfe2c2f745d348c30be2adbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Sun, 16 Jun 2019 11:13:07 +0200 Subject: Partial fix to #336 Change history file location --- src/history.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/history.c') diff --git a/src/history.c b/src/history.c index f7c1e0b..64fd77f 100644 --- a/src/history.c +++ b/src/history.c @@ -100,6 +100,7 @@ void set_comp(int i) { #include #include #include +#include #include "history.h" #include "sc.h" @@ -193,13 +194,15 @@ int save_history(struct history * h, char * mode) { FILE * f; int i; struct hlist * nl = h->list; - if ((home = getenv("HOME"))) { + char history_folder[PATHLEN]; + sprintf(history_folder, "%s/", home); + strcat(history_folder, HISTORY_FOLDER); + mkdir(history_folder,0777); sprintf(infofile, "%s/", home); strcat(infofile, HISTORY_FILE); f = fopen(infofile, mode); if (f == NULL) return 0; - // Go to the end for (i=1; i < h->len; i++) { nl = nl->pnext; -- cgit v1.2.3