diff --git a/src/main/server.c b/src/main/server.c index f04a318e305743185a334c6fe25cbf000219aafe..cb68297692854d88348f5a0b9bba7ef3dd182496 100644 --- a/src/main/server.c +++ b/src/main/server.c @@ -243,16 +243,19 @@ static inline void ___resolve_path(void) { const char *env_PATH = getenv("PATH"); - if (___is_appimage) { - char new_path[PATH_MAX]; - char exe_path[LKT_LINE_MAX]; - GOTO_IF(read_self_exe(exe_path, LKT_LINE_MAX), "Failed to get exe path", error); - char *self_dir = dirname(exe_path); - safe_snprintf(new_path, PATH_MAX, "%s:%s", self_dir, env_PATH); - GOTO_IF(setenv("PATH", new_path, 1), "Failed to set new PATH", error); - } -error: + RETURN_UNLESS(env_PATH, "Failed to get PATH in env", NOTHING); + char new_path[PATH_MAX]; + char exe_path[LKT_LINE_MAX]; + GOTO_IF(read_self_exe(exe_path, LKT_LINE_MAX), "Failed to get exe path", error); + char *self_dir = dirname(exe_path); + LOG_DEBUG("INIT", "Try to patch PATH with %s", self_dir); + safe_snprintf(new_path, PATH_MAX, "%s:%s", self_dir, env_PATH); + GOTO_IF(setenv("PATH", new_path, 1), "Failed to set new PATH", error); + env_PATH = getenv("PATH"); LOG_DEBUG("INIT", "PATH is: %s", env_PATH); + return; +error: + LOG_DEBUG("INIT", "Failed to patch PATH, it will remain as: %s", env_PATH); } int