summaryrefslogtreecommitdiff
path: root/src/lib/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2023-11-23 00:04:18 +0100
committerCarl Hetherington <cth@carlh.net>2023-11-29 21:20:31 +0100
commit402bf16eb94fa6680ceed03f899c02645de1d982 (patch)
treececc4064e92b4f14eb6964d1c0e5b995f658dd32 /src/lib/util.cc
parent9c8ca7ad6c50602d30f842c0186513f9cfc7a5bb (diff)
Add method to setup LD_LIBRARY_PATH for grok.
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 8cfdf0552..a25914a6c 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -1117,3 +1117,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