From 88c2ce7ee5ae0eedadb6895e540576b1027ce03e Mon Sep 17 00:00:00 2001 From: Deve Date: Mon, 25 Feb 2019 22:02:38 +0100 Subject: [PATCH] Use system LD_LIBRARY_PATH when opening web browser --- src/online/link_helper.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/online/link_helper.cpp b/src/online/link_helper.cpp index 1dae709b6..8c25bda73 100644 --- a/src/online/link_helper.cpp +++ b/src/online/link_helper.cpp @@ -47,10 +47,31 @@ namespace Online } #elif defined(__linux__) && !defined(__ANDROID__) std::string command = std::string("xdg-open ").append(url); + + const char* lib_path = getenv("LD_LIBRARY_PATH"); + const char* system_lib_path = getenv("SYSTEM_LD_LIBRARY_PATH"); + + if (system_lib_path != NULL) + { + setenv("LD_LIBRARY_PATH", system_lib_path, 1); + } + if (system(command.c_str())) { Log::error("OpenURL", "Command returned non-zero exit status"); } + + if (system_lib_path != NULL) + { + if (lib_path != NULL) + { + setenv("LD_LIBRARY_PATH", lib_path, 1); + } + else + { + unsetenv("LD_LIBRARY_PATH"); + } + } #else Log::error("OpenURL", "Not implemented for this platform!"); #endif