1
0
mirror of synced 2024-11-13 18:50:53 +01:00

sys: putenv sucks. Use setenv instead

This commit is contained in:
WerWolv 2023-01-07 10:56:03 +01:00
parent c26bed894b
commit d86be9d9b3
2 changed files with 2 additions and 2 deletions

View File

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

View File

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