From e093f57c1075104df8135df1c04f4d134d5a7db6 Mon Sep 17 00:00:00 2001 From: hakan-demirli Date: Mon, 8 Jan 2024 08:49:04 +0300 Subject: [PATCH] fix: fail if neither HOME nor XDG_STATE_HOME are set --- kernel/driver.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/driver.cc b/kernel/driver.cc index 503899d30..3a5e49cb4 100644 --- a/kernel/driver.cc +++ b/kernel/driver.cc @@ -247,12 +247,14 @@ int main(int argc, char **argv) if (getenv("XDG_STATE_HOME") == NULL || getenv("XDG_STATE_HOME")[0] == '\0') { if (getenv("HOME") != NULL) { yosys_history_file = stringf("%s/.local/state/.yosys_history", getenv("HOME")); + read_history(yosys_history_file.c_str()); + yosys_history_offset = where_history(); } } else { yosys_history_file = stringf("%s/.yosys_history", getenv("XDG_STATE_HOME")); + read_history(yosys_history_file.c_str()); + yosys_history_offset = where_history(); } - 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")))