diff options
author | Rostislav Beneš <r.dee.b.b@gmail.com> | 2017-10-08 21:42:22 +0200 |
---|---|---|
committer | Rostislav Beneš <r.dee.b.b@gmail.com> | 2017-10-22 21:01:40 +0200 |
commit | ba4cefe4ae70cfb9121281f508ed5d9fa9dbc662 (patch) | |
tree | 01863d0fcf1edc435bd3ccc998f8262a7486a21e /pkgs/development/libraries/aspell/data-dirs-from-nix-profiles.patch | |
parent | 6d86fcb86de75a307684cf2e6b8a518bd458427c (diff) |
aspell: added new patch data-dirs-from-nix-profiles.patch
Aspell will search for dictionaries in all nix profiles even when used as library.
Setting data-dir or dict-dir in ASPELL_CONF will disable this behavior.
Diffstat (limited to 'pkgs/development/libraries/aspell/data-dirs-from-nix-profiles.patch')
-rw-r--r-- | pkgs/development/libraries/aspell/data-dirs-from-nix-profiles.patch | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/pkgs/development/libraries/aspell/data-dirs-from-nix-profiles.patch b/pkgs/development/libraries/aspell/data-dirs-from-nix-profiles.patch new file mode 100644 index 000000000000..c19827ba93e4 --- /dev/null +++ b/pkgs/development/libraries/aspell/data-dirs-from-nix-profiles.patch @@ -0,0 +1,38 @@ +diff --git a/common/info.cpp b/common/info.cpp +index 8291cc7..6216326 100644 +--- a/common/info.cpp ++++ b/common/info.cpp +@@ -36,6 +36,7 @@ + #include "strtonum.hpp" + #include "lock.hpp" + #include "string_map.hpp" ++#include "file_util.hpp" + + #include "gettext.h" + +@@ -495,6 +496,25 @@ namespace acommon { + lst.clear(); + lst.add(config->retrieve("data-dir")); + lst.add(config->retrieve("dict-dir")); ++ if (config->lookup("data-dir") == NULL && config->lookup("dict-dir") == NULL) { ++ const char* cprofiles = getenv("NIX_PROFILES"); ++ if (cprofiles != NULL) { ++ char* profiles = strdup(cprofiles); ++ char* profile = profiles; ++ char* end = profile; ++ while (*end != '\0') { ++ if (*end == ' ') { ++ *end = '\0'; ++ lst.add(add_possible_dir(profile, "lib/aspell")); ++ profile = ++end; ++ } else { ++ ++end; ++ } ++ } ++ lst.add(add_possible_dir(profile, "lib/aspell")); ++ free(profiles); ++ } ++ } + } + + DictExt::DictExt(ModuleInfo * m, const char * e) |