Don't permit spaces in USERPROFILE

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@15147 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-11-27 16:50:36 +00:00
parent d70630d4ed
commit 98524d8d1c

View file

@ -261,6 +261,20 @@ NSHomeDirectoryForUser(NSString *loginName)
/* The environment variable USERPROFILE holds the home directory
for the user on more modern versions of windoze. */
s = GSStringFromWin32EnvironmentVariable("USERPROFILE");
if (s != nil)
{
const char *str = [s cString];
while (*str != '\0')
{
if (isspace(*str))
{
s = nil; // Whitespace not permitted in USERPROFILE
break;
}
str++;
}
}
if (s == nil)
{
/* The environment variable HOMEPATH holds the home directory