Skip to content

Commit

Permalink
Get home directory on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
JustDoom committed Dec 7, 2024
1 parent 0eacb57 commit c9afbc5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ int main(int argc, char **argv) {
}
}

auto home = std::getenv("HOME");
const char* home = nullptr;
#ifdef _WIN32
home = std::getenv("USERPROFILE");
#else
home = std::getenv("HOME");
#endif
if (!home) {
std::cerr << "HOME environment variable not set!" << std::endl;
return 1;
Expand Down

0 comments on commit c9afbc5

Please sign in to comment.