From d712e2084ae7c2841fbe98a378db36e70252fc0f Mon Sep 17 00:00:00 2001 From: Date: Wed, 29 Jul 2009 08:38:20 +0000 Subject: [PATCH] Fix user name detection for Windows. This patch was given by ademin (thanks!). http://code.google.com/p/google-glog/issues/detail?id=12 git-svn-id: https://google-glog.googlecode.com/svn/trunk@64 eb4d4688-79bd-11dd-afb4-1d65580434c0 --- src/utilities.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/utilities.cc b/src/utilities.cc index 149245c..d35744e 100644 --- a/src/utilities.cc +++ b/src/utilities.cc @@ -268,7 +268,11 @@ const string& MyUserName() { } static void MyUserNameInitializer() { // TODO(hamaji): Probably this is not portable. +#if defined(OS_WINDOWS) + const char* user = getenv("USERNAME"); +#else const char* user = getenv("USER"); +#endif if (user != NULL) { g_my_user_name = user; } else { -- 2.7.4