diff --git a/include/init/splash_window.hpp b/include/init/splash_window.hpp index e360bb4d1..ca60c5cf0 100644 --- a/include/init/splash_window.hpp +++ b/include/init/splash_window.hpp @@ -14,7 +14,7 @@ namespace hex::init { class WindowSplash { public: - WindowSplash(int &argc, char **&argv); + WindowSplash(int &argc, char **&argv, char **&envp); ~WindowSplash(); bool loop(); @@ -40,4 +40,4 @@ namespace hex::init { std::vector> m_tasks; }; -} \ No newline at end of file +} diff --git a/plugins/libimhex/include/hex/helpers/shared_data.hpp b/plugins/libimhex/include/hex/helpers/shared_data.hpp index 69082d2f0..686169723 100644 --- a/plugins/libimhex/include/hex/helpers/shared_data.hpp +++ b/plugins/libimhex/include/hex/helpers/shared_data.hpp @@ -93,6 +93,7 @@ namespace hex { static int mainArgc; static char **mainArgv; + static char **mainEnvp; static ImFontAtlas *fontAtlas; static ImFontConfig fontConfig; @@ -106,4 +107,4 @@ namespace hex { static std::map sharedVariables; }; -} \ No newline at end of file +} diff --git a/plugins/libimhex/source/api/imhex_api.cpp b/plugins/libimhex/source/api/imhex_api.cpp index 1735fff5c..15f2b0d60 100644 --- a/plugins/libimhex/source/api/imhex_api.cpp +++ b/plugins/libimhex/source/api/imhex_api.cpp @@ -16,7 +16,7 @@ namespace hex { void ImHexApi::Common::restartImHex() { EventManager::post(false); std::atexit([]{ - execve(SharedData::mainArgv[0], SharedData::mainArgv, nullptr); + execve(SharedData::mainArgv[0], SharedData::mainArgv, SharedData::mainEnvp); }); } @@ -86,4 +86,4 @@ namespace hex { return Task(unlocalizedName, maxValue); } -} \ No newline at end of file +} diff --git a/plugins/libimhex/source/helpers/shared_data.cpp b/plugins/libimhex/source/helpers/shared_data.cpp index 87299d109..e20d90544 100644 --- a/plugins/libimhex/source/helpers/shared_data.cpp +++ b/plugins/libimhex/source/helpers/shared_data.cpp @@ -43,6 +43,7 @@ namespace hex { int SharedData::mainArgc; char **SharedData::mainArgv; + char **SharedData::mainEnvp; ImFontAtlas *SharedData::fontAtlas; ImFontConfig SharedData::fontConfig; @@ -53,4 +54,4 @@ namespace hex { float SharedData::fontScale; std::map SharedData::sharedVariables; -} \ No newline at end of file +} diff --git a/source/init/splash_window.cpp b/source/init/splash_window.cpp index a1a594056..b971a19f0 100644 --- a/source/init/splash_window.cpp +++ b/source/init/splash_window.cpp @@ -25,9 +25,10 @@ using namespace std::literals::chrono_literals; namespace hex::init { - WindowSplash::WindowSplash(int &argc, char **&argv) : m_window(nullptr) { + WindowSplash::WindowSplash(int &argc, char **&argv, char **&envp) : m_window(nullptr) { SharedData::mainArgc = argc; SharedData::mainArgv = argv; + SharedData::mainEnvp = envp; this->initGLFW(); this->initImGui(); @@ -239,4 +240,4 @@ namespace hex::init { ImGui::DestroyContext(); } -} \ No newline at end of file +} diff --git a/source/main.cpp b/source/main.cpp index 4c365db7f..b23957bff 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -10,14 +10,14 @@ #include -int main(int argc, char **argv) { +int main(int argc, char **argv, char **envp) { using namespace hex; // Initialization { Window::initNative(); - init::WindowSplash splashWindow(argc, argv); + init::WindowSplash splashWindow(argc, argv, envp); for (const auto &[name, task] : init::getInitTasks()) splashWindow.addStartupTask(name, task);