Commit d712e208 authored by 's avatar

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
parent fc88a722
...@@ -268,7 +268,11 @@ const string& MyUserName() { ...@@ -268,7 +268,11 @@ const string& MyUserName() {
} }
static void MyUserNameInitializer() { static void MyUserNameInitializer() {
// TODO(hamaji): Probably this is not portable. // TODO(hamaji): Probably this is not portable.
#if defined(OS_WINDOWS)
const char* user = getenv("USERNAME");
#else
const char* user = getenv("USER"); const char* user = getenv("USER");
#endif
if (user != NULL) { if (user != NULL) {
g_my_user_name = user; g_my_user_name = user;
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment