diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-11-23 00:04:18 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2023-12-16 02:07:38 +0100 |
| commit | 4c09f5e51af4fc5d064cd7462b89c0d455dfab2a (patch) | |
| tree | 23685d27e6b41a655480ff08ac6b753c9a8c8628 | |
| parent | 038eaffc07e8729fb380e18ae80732bb75f84094 (diff) | |
Add method to setup LD_LIBRARY_PATH for grok.
| -rw-r--r-- | src/lib/util.cc | 25 | ||||
| -rw-r--r-- | src/lib/util.h | 3 |
2 files changed, 28 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 diff --git a/src/lib/util.h b/src/lib/util.h index 2d65b9214..b85cf0a33 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -98,6 +98,9 @@ extern std::string error_details(boost::system::error_code ec); extern bool contains_assetmap(boost::filesystem::path dir); extern std::string word_wrap(std::string input, int columns); extern void capture_ffmpeg_logs(); +#ifdef DCPOMATIC_GROK +extern void setup_grok_library_path(); +#endif template <class T> |
