As mentioned in last e-mail, this patch is active only for
MinGW32 targets.
For MinGW32 targets, this patch prepends the SystemDrive
environment variable to gnustep_local_root,
gnustep_system_root and gnustep_network_root at runtime, if
and only if there are no environment variables set for these
with GNUSTEP_SYSTEM_ROOT etc.
The patch also fixes a bug with the stringify() macro that
would have affected all platforms, and a typo in an error
message.
Stephen Brandon
[EMAIL PROTECTED]
Index: base/Source/NSUser.m
===================================================================
RCS file: /cvsroot/gnustep/gnustep/core/base/Source/NSUser.m,v
retrieving revision 1.46
diff -r1.46 NSUser.m
49c49,50
< #define stringify(X) #X
---
> #define lowlevelstringify(X) #X
> #define stringify(X) lowlevelstringify(X)
127c128
< format: @"Unable to determine curren user name"];
---
> format: @"Unable to determine current user name"];
139c140
< /* Return LOGIN_NAME's home directory as an NSString object. */
---
> #if defined(__MINGW__)
141c142
< NSHomeDirectoryForUser(NSString *login_name)
---
> GSStringFromWin32EnvironmentVariable(const char * envVar)
143,152d143
< #if !defined(__MINGW__)
< struct passwd *pw;
<
< [gnustep_global_lock lock];
< pw = getpwnam ([login_name cString]);
< [gnustep_global_lock unlock];
< return [NSString stringWithCString: pw->pw_dir];
< #else
< /* Then environment variable HOMEPATH holds the home directory
< for the user on Windows NT; Win95 has no concept of home. */
155c146
< NSString *s;
---
> NSString *s = nil;
158c149
< n = GetEnvironmentVariable("HOMEPATH", buf, 1024);
---
> n = GetEnvironmentVariable(envVar, buf, 1024);
163c154
< n = GetEnvironmentVariable("HOMEPATH", nb, n+1);
---
> n = GetEnvironmentVariable(envVar, nb, n+1);
174,177c165,175
< else
< {
< s = nil;
< }
---
> [gnustep_global_lock unlock];
> return s;
> }
> #endif
>
> /* Return LOGIN_NAME's home directory as an NSString object. */
> NSString *
> NSHomeDirectoryForUser(NSString *login_name)
> {
> #if !defined(__MINGW__)
> struct passwd *pw;
178a177,187
> [gnustep_global_lock lock];
> pw = getpwnam ([login_name cString]);
> [gnustep_global_lock unlock];
> return [NSString stringWithCString: pw->pw_dir];
> #else
> /* Then environment variable HOMEPATH holds the home directory
> for the user on Windows NT; Win95 has no concept of home. */
> NSString *s;
>
> [gnustep_global_lock lock];
> s = GSStringFromWin32EnvironmentVariable("HOMEPATH");
181,183c190,191
< n = GetEnvironmentVariable("HOMEDRIVE", buf, 1024);
< buf[n] = '\0';
< s = [[NSString stringWithCString: buf] stringByAppendingString: s];
---
> s = [GSStringFromWin32EnvironmentVariable("HOMEDRIVE")
> stringByAppendingString: s];
213a222,224
> #if defined (__MINGW32__)
> NSString *systemDrive = GSStringFromWin32EnvironmentVariable("SystemDrive");
> #endif
240a252,256
> #if defined (__MINGW32__)
> gnustep_system_root = [systemDrive stringByAppendingString:
> gnustep_system_root];
> #endif
>
252a269,272
> #if defined (__MINGW32__)
> gnustep_local_root = [systemDrive stringByAppendingString:
> gnustep_local_root];
> #endif
289a310,313
> #if defined (__MINGW32__)
> gnustep_network_root = [systemDrive stringByAppendingString:
> gnustep_network_root];
> #endif