Skip to content

Commit

Permalink
Add VARNAM_SUGGESTIONS_DIR env var to mention directory where learnin…
Browse files Browse the repository at this point in the history
…gs should be stored
  • Loading branch information
subins2000 committed Jul 25, 2019
1 parent 7b41660 commit cccafe2
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions varnam.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,21 @@ find_learnings_file_path (const char *langCode)
}
}
#else
tmp = getenv ("XDG_DATA_HOME");
tmp = getenv ("VARNAM_SUGGESTIONS_DIR");
if (tmp == NULL) {
tmp = getenv ("HOME");
if (tmp != NULL) {
strbuf_addf (path, "%s/.local/share/varnam/suggestions/", tmp);
}
tmp = getenv ("XDG_DATA_HOME");
if (tmp == NULL) {
tmp = getenv ("HOME");
if (tmp != NULL) {
strbuf_addf (path, "%s/.local/share/varnam/suggestions/", tmp);
}
}
else {
strbuf_addf (path, "%s/varnam/suggestions/", tmp);
}
}
else {
strbuf_addf (path, "%s/varnam/suggestions/", tmp);
strbuf_addf (path, "%s/", tmp);
}

if (!strbuf_is_blank (path)) {
Expand Down

0 comments on commit cccafe2

Please sign in to comment.