Skip to content

Commit 3edf176

Browse files
authored
Fix home_dir() for MinGW (#131)
1 parent 2295c2b commit 3edf176

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

loguru.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,11 @@ namespace loguru
695695

696696
const char* home_dir()
697697
{
698-
#ifdef _WIN32
698+
#ifdef __MINGW32__
699+
auto home = getenv("USERPROFILE");
700+
CHECK_F(home != nullptr, "Missing USERPROFILE");
701+
return home;
702+
#elif defined(_WIN32)
699703
char* user_profile;
700704
size_t len;
701705
errno_t err = _dupenv_s(&user_profile, &len, "USERPROFILE");

0 commit comments

Comments
 (0)