Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1diff --git a/common/info.cpp b/common/info.cpp 2index 8291cc7..6216326 100644 3--- a/common/info.cpp 4+++ b/common/info.cpp 5@@ -36,6 +36,7 @@ 6 #include "strtonum.hpp" 7 #include "lock.hpp" 8 #include "string_map.hpp" 9+#include "file_util.hpp" 10 11 #include "gettext.h" 12 13@@ -495,6 +496,25 @@ namespace acommon { 14 lst.clear(); 15 lst.add(config->retrieve("data-dir")); 16 lst.add(config->retrieve("dict-dir")); 17+ if (config->lookup("data-dir") == NULL && config->lookup("dict-dir") == NULL) { 18+ const char* cprofiles = getenv("NIX_PROFILES"); 19+ if (cprofiles != NULL) { 20+ char* profiles = strdup(cprofiles); 21+ char* profile = profiles; 22+ char* end = profile; 23+ while (*end != '\0') { 24+ if (*end == ' ') { 25+ *end = '\0'; 26+ lst.add(add_possible_dir(profile, "lib/aspell")); 27+ profile = ++end; 28+ } else { 29+ ++end; 30+ } 31+ } 32+ lst.add(add_possible_dir(profile, "lib/aspell")); 33+ free(profiles); 34+ } 35+ } 36 } 37 38 DictExt::DictExt(ModuleInfo * m, const char * e)