Skip to content

Commit

Permalink
fix: fail if neither HOME nor XDG_STATE_HOME are set
Browse files Browse the repository at this point in the history
  • Loading branch information
hakan-demirli committed Jan 8, 2024
1 parent 54c3b63 commit e093f57
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions kernel/driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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")))
Expand Down

0 comments on commit e093f57

Please sign in to comment.