From d86be9d9b3895649548e5d45438a3de5156da059 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Sat, 7 Jan 2023 10:56:03 +0100 Subject: [PATCH] sys: `putenv` sucks. Use `setenv` instead --- main/source/window/linux_window.cpp | 2 +- main/source/window/macos_window.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main/source/window/linux_window.cpp b/main/source/window/linux_window.cpp index b7285c42d..58f9b63b2 100644 --- a/main/source/window/linux_window.cpp +++ b/main/source/window/linux_window.cpp @@ -21,7 +21,7 @@ namespace hex { // Add plugin library folders to dll search path for (const auto &path : hex::fs::getDefaultPaths(fs::ImHexPath::Libraries)) { if (std::fs::exists(path)) - putenv(hex::format("LD_LIBRARY_PATH={}", path.c_str()).c_str()); + setenv("LD_LIBRARY_PATH", hex::format("{};{}", hex::getEnvironmentVariable("LD_LIBRARY_PATH").value_or(""), path.string().c_str()).c_str(), true); } if (!isatty(STDOUT_FILENO)) { diff --git a/main/source/window/macos_window.cpp b/main/source/window/macos_window.cpp index 455acffff..ea3d9c57d 100644 --- a/main/source/window/macos_window.cpp +++ b/main/source/window/macos_window.cpp @@ -20,7 +20,7 @@ namespace hex { // Add plugin library folders to dll search path for (const auto &path : hex::fs::getDefaultPaths(fs::ImHexPath::Libraries)) { if (std::fs::exists(path)) - putenv(hex::format("LD_LIBRARY_PATH={}", path.c_str()).c_str()); + setenv("LD_LIBRARY_PATH", hex::format("{};{}", hex::getEnvironmentVariable("LD_LIBRARY_PATH").value_or(""), path.string().c_str()).c_str(), true); } if (!isatty(STDOUT_FILENO)) {