From 1b93f5d09dbcc4959b31a01c41ce2d439646d096 Mon Sep 17 00:00:00 2001 From: Zachary Hall Date: Fri, 1 Dec 2023 16:07:57 -0800 Subject: [PATCH] Maybe fix Win32 compat --- main.cpp | 2 +- win32compat.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index 31ae4dc..80671c5 100644 --- a/main.cpp +++ b/main.cpp @@ -64,7 +64,7 @@ int main(int argc, char **argv) { uint8_t br, bg, bb; bool border_set = false; bool probe_only = false; - std::filesystem::path executable_path = std::filesystem::weakly_canonical(*argv).parent_path(); + std::string executable_path = std::filesystem::weakly_canonical(*argv).parent_path().generic_string(); #ifdef _WIN32 setenv("MAGICK_CODER_MODULE_PATH", executable_path.c_str(), 0); #endif diff --git a/win32compat.h b/win32compat.h index e8f6a76..e0fe786 100644 --- a/win32compat.h +++ b/win32compat.h @@ -2,8 +2,9 @@ #ifdef _WIN32 #include +#include inline void setenv(const char *variable, const char *value, char replace) { - if (replace || getenv(variable) == NULL || getenv(variable) == "") { + if (replace || getenv(variable) == NULL || !strcmp(getenv(variable), "")) { if (value == NULL) { _putenv_s(variable, ""); } else {