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
This commit is contained in:
parent
fc88a722eb
commit
d712e2084a
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user