Use system LD_LIBRARY_PATH when opening web browser

This commit is contained in:
Deve 2019-02-25 22:02:38 +01:00
parent ca0636ed03
commit 88c2ce7ee5

View File

@ -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