Skip to content

Commit c27c4a8

Browse files
ADAM Martinevergreen
authored andcommitted
SERVER-42969 Fix handling of Unicode strings in windows USERPROFILE environment variable.
1 parent c33abed commit c27c4a8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/mongo/shell/shell_utils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ namespace mongo::shell_utils {
6969
namespace {
7070
boost::filesystem::path getUserDir() {
7171
#ifdef _WIN32
72-
auto envp = getenv("USERPROFILE");
73-
if (envp)
74-
return envp;
72+
auto wenvp = _wgetenv(L"USERPROFILE");
73+
if (wenvp)
74+
return toUtf8String(wenvp);
7575

7676
return "./";
7777
#else

0 commit comments

Comments
 (0)