From 31b45c9555752070c7a8909ade46a95093979188 Mon Sep 17 00:00:00 2001 From: hakan-demirli Date: Sun, 7 Jan 2024 14:17:48 +0300 Subject: [PATCH] fix: xdg spec for hist --- kernel/driver.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/kernel/driver.cc b/kernel/driver.cc index c1995e7f7..eda90745a 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -244,15 +244,13 @@ int main(int argc, char **argv) bool mode_q = false; #if defined(YOSYS_ENABLE_READLINE) || defined(YOSYS_ENABLE_EDITLINE) - if (getenv("XDG_DATA_HOME") != NULL && getenv("XDG_DATA_HOME")[0] != '\0') { - yosys_history_file = stringf("%s/yosys/.yosys_history", getenv("XDG_DATA_HOME")); - read_history(yosys_history_file.c_str()); - yosys_history_offset = where_history(); - } else if (getenv("HOME") != NULL) { - yosys_history_file = stringf("%s/.yosys_history", getenv("HOME")); - read_history(yosys_history_file.c_str()); - yosys_history_offset = where_history(); + if (getenv("XDG_STATE_HOME") != NULL && getenv("XDG_STATE_HOME")[0] != '\0') { + yosys_history_file = stringf("%s/.local/state/.yosys_history", getenv("HOME")); + } else { + yosys_history_file = stringf("%s/.yosys_history", getenv("XDG_STATE_HOME")); } + read_history(yosys_history_file.c_str()); + yosys_history_offset = where_history(); #endif if (argc == 2 && (!strcmp(argv[1], "-h") || !strcmp(argv[1], "-help") || !strcmp(argv[1], "--help")))