platform/platform_filesystem.c
/*	Returns the name of the systems	current user.
	TODO:
		Move this into platform_system
*/
Returns the name of the systems current user.
TODO:
Move this into platform_system
Returns the name of the systems current user . TODO : Move this into platform_system
void plGetUserName(char *out)
{
	pFUNCTION_START
#ifdef _WIN32
	char	userstring[PLATFORM_MAX_USER];
	DWORD	name;
	name = sizeof(userstring);
	if (GetUserName(userstring, &name) == 0)
		sprintf(userstring, "user");
#else   
	char *userstring = getenv("LOGNAME");
	if (userstring == NULL)
		userstring = "user";
#endif
	{
		int	i = 0,
			userlength = (int)strlen(userstring);
		while (i < userlength)
		{
			if (userstring[i] == ' ')
				out[i] = '_';
			else
				out[i] = (char)tolower(userstring[i]);
			i++;
		}
	}
	pFUNCTION_END
}
void plGetUserName ( char * out ) { pFUNCTION_START #ifdef _WIN32 char userstring [ PLATFORM_MAX_USER ] ; DWORD name ; name = sizeof ( userstring ) ; if ( GetUserName ( userstring , & name ) == 0 ) sprintf ( userstring , " " ) ; #else char * userstring = getenv ( " " ) ; if ( userstring == NULL ) userstring = " " ; #endif { int i = 0 , userlength = ( int ) strlen ( userstring ) ; while ( i < userlength ) { if ( userstring [ i ] == ' ' ) out [ i ] = ' ' ; else out [ i ] = ( char ) tolower ( userstring [ i ] ) ; i ++ ; } } pFUNCTION_END }
Returns the name of the systems current user.
Returns the name of the systems current user .
// Set these AFTER we update active function. // If it fails, just set it to user. // Linux // If it fails, just set it to user. //strncpy(out, cUser, sizeof(out));