[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug in NSUser.m:NSHomeDirectoryForUser() on mingw32
From: |
Michael Scheibler |
Subject: |
bug in NSUser.m:NSHomeDirectoryForUser() on mingw32 |
Date: |
Thu, 1 Mar 2001 14:52:25 +0100 |
HOMEPATH only delivers path without drive. The correct "path" is HOMEDRIVE +
HOMEPATH.
/* Then environment variable HOMEPATH holds the home directory
for the user on Windows NT; Win95 has no concept of home. */
char buf[1024], *nb;
DWORD n;
NSString *s;
[gnustep_global_lock lock];
n = GetEnvironmentVariable("HOMEPATH", buf, 1024);
if (n > 1024)
{
/* Buffer not big enough, so dynamically allocate it */
nb = (char *)NSZoneMalloc(NSDefaultMallocZone(), sizeof(char)*(n+1));
n = GetEnvironmentVariable("HOMEPATH", nb, n+1);
nb[n] = '\0';
s = [NSString stringWithCString: nb];
NSZoneFree(NSDefaultMallocZone(), nb);
}
else if (n > 0)
{
/* null terminate it and return the string */
buf[n] = '\0';
s = [NSString stringWithCString: buf];
}
else
s = nil;
/* BUGFIX begins here (suggestion): */
if (s)
{
n = GetEnvironmentVariable("HOMEDRIVE", buf, 1024);
buf[n] = '\0';
s = [[NSString stringWithCString: buf] stringByAppendingString: s];
}
/* BUGFIX end */
[gnustep_global_lock unlock];
return s;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug in NSUser.m:NSHomeDirectoryForUser() on mingw32,
Michael Scheibler <=