Maybe fix Win32 compat

This commit is contained in:
Zachary Hall 2023-12-01 16:07:57 -08:00
parent 6a1b491844
commit 1b93f5d09d
2 changed files with 3 additions and 2 deletions

View file

@ -64,7 +64,7 @@ int main(int argc, char **argv) {
uint8_t br, bg, bb; uint8_t br, bg, bb;
bool border_set = false; bool border_set = false;
bool probe_only = 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 #ifdef _WIN32
setenv("MAGICK_CODER_MODULE_PATH", executable_path.c_str(), 0); setenv("MAGICK_CODER_MODULE_PATH", executable_path.c_str(), 0);
#endif #endif

View file

@ -2,8 +2,9 @@
#ifdef _WIN32 #ifdef _WIN32
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
inline void setenv(const char *variable, const char *value, char replace) { 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) { if (value == NULL) {
_putenv_s(variable, ""); _putenv_s(variable, "");
} else { } else {