summaryrefslogtreecommitdiff
path: root/src/lib/util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/util.cc')
-rw-r--r--src/lib/util.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 5e1b2ee49..e8cbe9843 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -1118,3 +1118,28 @@ word_wrap(string input, int columns)
return output;
}
+
+
+#ifdef DCPOMATIC_GROK
+void
+setup_grok_library_path()
+{
+ static std::string old_path;
+ if (old_path.empty()) {
+ old_path = getenv("LD_LIRARY_PATH");
+ }
+ auto const grok = Config::instance()->grok();
+ if (!grok || grok->binary_location.empty()) {
+ setenv("LD_LIRARY_PATH", old_path.c_str(), 1);
+ return;
+ }
+
+ std::string new_path = old_path;
+ if (!new_path.empty()) {
+ new_path += ":";
+ }
+ new_path += grok->binary_location.string();
+
+ setenv("LD_LIBRARY_PATH", new_path.c_str(), 1);
+}
+#endif