2023-12-01 16:01:45 -08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <stdlib.h>
|
2023-12-01 16:07:57 -08:00
|
|
|
#include <string.h>
|
2023-12-01 16:05:37 -08:00
|
|
|
inline void setenv(const char *variable, const char *value, char replace) {
|
2023-12-01 16:07:57 -08:00
|
|
|
if (replace || getenv(variable) == NULL || !strcmp(getenv(variable), "")) {
|
2023-12-01 16:01:45 -08:00
|
|
|
if (value == NULL) {
|
|
|
|
_putenv_s(variable, "");
|
|
|
|
} else {
|
|
|
|
_putenv_s(variable, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#include <unistd.h>
|
|
|
|
#endif
|