1 From 8c67f314de2684d77315eecd99ef091d441f17dd Mon Sep 17 00:00:00 2001
2 From: Matthew Bauer <mjbauer95@gmail.com>
3 Date: Wed, 24 Jul 2019 15:35:18 -0400
4 Subject: [PATCH] Make hunspell look in XDG_DATA_DIRS for dictionaries
6 Some dictionaries may exist but only show up under XDG_DATA_DIRS. For
7 instance, $HOME/.local/share/hunspell could contain some dictionaries.
9 This patch adds each directory in the hunspell subdir of each
10 XDG_DATA_DIRS to the lookup path.
12 Upstream pr is available at: https://github.com/hunspell/hunspell/pull/637
14 src/tools/hunspell.cxx | 7 +++++++
15 1 file changed, 7 insertions(+)
17 diff --git a/src/tools/hunspell.cxx b/src/tools/hunspell.cxx
18 index 690e34a..6cd127e 100644
19 --- a/src/tools/hunspell.cxx
20 +++ b/src/tools/hunspell.cxx
21 @@ -2044,6 +2044,13 @@ int main(int argc, char** argv) {
22 if (getenv("DICPATH")) {
23 path_std_str.append(getenv("DICPATH")).append(PATHSEP);
25 + if (getenv("XDG_DATA_DIRS")) {
26 + char* dir = strtok(getenv("XDG_DATA_DIRS"), ":");
27 + while (dir != NULL) {
28 + path_std_str.append(dir).append("/hunspell:");
29 + dir = strtok(NULL, ":");
32 path_std_str.append(LIBDIR).append(PATHSEP);
34 const char * userooodir[] = USEROOODIR;