summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorADAM Martin <adam.martin@mongodb.com>2019-08-29 19:50:15 +0000
committerADAM David Alan Martin <adam.martin@10gen.com>2019-09-12 15:18:57 -0400
commit0ace133fc77c0b19330ed4720479d9c222a4e161 (patch)
treea029f1ac90131264f0b7c659577f95adbec85ff4
parent08e81689618d7bf906377913e4f2958ce216e275 (diff)
downloadmongo-0ace133fc77c0b19330ed4720479d9c222a4e161.tar.gz
SERVER-42969 Fix handling of Unicode strings in windows `USERPROFILE` environment variable.
(cherry picked from commit c27c4a843018761c32013810e39fd3838aa229b8)
-rw-r--r--src/mongo/shell/shell_utils.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mongo/shell/shell_utils.cpp b/src/mongo/shell/shell_utils.cpp
index fe7905c9be7..28b2747b071 100644
--- a/src/mongo/shell/shell_utils.cpp
+++ b/src/mongo/shell/shell_utils.cpp
@@ -68,9 +68,9 @@ namespace mongo::shell_utils {
namespace {
boost::filesystem::path getUserDir() {
#ifdef _WIN32
- auto envp = getenv("USERPROFILE");
- if (envp)
- return envp;
+ auto wenvp = _wgetenv(L"USERPROFILE");
+ if (wenvp)
+ return toUtf8String(wenvp);
return "./";
#else