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;


_______________________________________________
Bug-gnustep mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to