Skip to content

Commit

Permalink
[REFACT] Cleanup in get_system_drive
Browse files Browse the repository at this point in the history
  • Loading branch information
hasherezade committed Apr 7, 2024
1 parent 0103753 commit 9136a9d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions utils/path_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ std::string pesieve::util::escape_path_separators(std::string path)

std::string pesieve::util::get_system_drive()
{
char buf[MAX_PATH];
GetWindowsDirectory(buf, MAX_PATH);
char buf[MAX_PATH] = { 0 };
if (!GetWindowsDirectoryA(buf, MAX_PATH)) {
return "";
}
buf[2] = '\0'; // cut after the drive letter
return std::string(buf);
}
Expand Down

0 comments on commit 9136a9d

Please sign in to comment.