From f50e8a3c1baaff8cb3c6055a2b18caab8ce904e3 Mon Sep 17 00:00:00 2001 From: hakan-demirli Date: Thu, 21 Dec 2023 21:44:02 +0300 Subject: [PATCH] Follow the XDG Base Directory Specification --- kernel/driver.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/driver.cc b/kernel/driver.cc index c779611e097..c1995e7f7fc 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -244,7 +244,11 @@ int main(int argc, char **argv) bool mode_q = false; #if defined(YOSYS_ENABLE_READLINE) || defined(YOSYS_ENABLE_EDITLINE) - if (getenv("HOME") != NULL) { + 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();