diff options
| author | Carl Hetherington <cth@carlh.net> | 2023-11-23 00:04:18 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2024-01-28 02:01:58 +0100 |
| commit | 31f635c82931488d226cedc4ffd971d7f0dec929 (patch) | |
| tree | 3859ca810fed7d882e334c75eb9cb5d33b4aa43e /src/lib | |
| parent | cebacd1b4f70dae7f503252d53e5a3e54c28c3dd (diff) | |
Add method to setup LD_LIBRARY_PATH for grok.
Diffstat (limited to 'src/lib')
| -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 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 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> |
