From 2682b811c9cb9e6d5359dfa80d3f6c73b7e2e50c Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Sat, 3 Mar 2001 09:14:56 +0000 Subject: [PATCH] MINGW fixes to home directory stuff. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@9276 72102866-910b-0410-8b05-ffd578937521 --- Source/NSFileManager.m | 9 ++++++--- Source/NSUser.m | 11 ++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Source/NSFileManager.m b/Source/NSFileManager.m index d4bd49a1c..a84183b55 100644 --- a/Source/NSFileManager.m +++ b/Source/NSFileManager.m @@ -1245,12 +1245,15 @@ static NSFileManager* defaultManager = nil; } else if (c_path[0] == '/') { - NSDictionary *env; + NSDictionary *env; + NSString *cyghome; + env = [[NSProcessInfo processInfo] environment]; - if ([env objectForKey: @"CYGWIN"]) + cyghome = [env objectForKey: @"CYGWIN_HOME"]; + if (cyghome != nil) { /* FIXME: Find cygwin drive? */ - newpath = @"c:/cygwin"; + newpath = cyghome; newpath = [newpath stringByAppendingPathComponent: path]; newpath = [newpath stringByReplacingString: @"/" withString: @"\\"]; } diff --git a/Source/NSUser.m b/Source/NSUser.m index caac42959..b03d8ed16 100644 --- a/Source/NSUser.m +++ b/Source/NSUser.m @@ -147,7 +147,16 @@ NSHomeDirectoryForUser(NSString *login_name) s = [NSString stringWithCString: buf]; } else - s = nil; + { + s = nil; + } + + if (s != nil) + { + n = GetEnvironmentVariable("HOMEDRIVE", buf, 1024); + buf[n] = '\0'; + s = [[NSString stringWithCString: buf] stringByAppendingString: s]; + } [gnustep_global_lock unlock]; return s; #endif