From 452f9663a93f72f3e8bd22927fdb0dba10653b3c Mon Sep 17 00:00:00 2001 From: Richard Frith-Macdonald Date: Fri, 1 Mar 2002 12:05:36 +0000 Subject: [PATCH] Mingw port git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@12919 72102866-910b-0410-8b05-ffd578937521 --- user_home.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/user_home.c b/user_home.c index e6a5a325..e8101b16 100644 --- a/user_home.c +++ b/user_home.c @@ -58,6 +58,12 @@ #define lowlevelstringify(X) #X #define stringify(X) lowlevelstringify(X) +#if defined(__MINGW__) +# define SEP "\\" +#else +# define SEP "/" +#endif + /* * This tool is intended to produce a definitive form of the * user specific root directories for a GNUstep user. It must @@ -193,11 +199,11 @@ int main (int argc, char** argv) #else /* Then environment variable HOMEPATH holds the home directory for the user on Windows NT; Win95 has no concept of home. */ - len0 = GetEnvironmentVariable("HOMEPATH", buf0, 1024); + len0 = GetEnvironmentVariable("HOMEDRIVE", buf0, 1024); if (len0 > 0 && len0 < 1024) { buf0[len0] = '\0'; - len1 = GetEnvironmentVariable("HOMEDRIVE", buf1, 128); + len1 = GetEnvironmentVariable("HOMEPATH", buf1, 128); if (len1 > 0 && len1 < 128) { buf1[len1] = '\0'; @@ -205,13 +211,13 @@ int main (int argc, char** argv) } else { - fprintf(stderr, "Unable to determine HOMEDRIVE\n"); + fprintf(stderr, "Unable to determine HOMEPATH\n"); return 1; } } else { - fprintf(stderr, "Unable to determine HOMEPATH\n"); + fprintf(stderr, "Unable to determine HOMEDRIVE\n"); return 1; } #endif @@ -226,7 +232,9 @@ int main (int argc, char** argv) char *user = ""; char *defs = ""; - sprintf(path, "%s/.GNUsteprc", home); + strcpy(path, home); + strcat(path, SEP); + strcat(path, ".GNUsteprc"); fptr = fopen(path, "r"); path[0] = '\0'; if (fptr != 0) @@ -279,7 +287,9 @@ int main (int argc, char** argv) if (*path == '\0') { - sprintf(path, "%s/GNUstep", home); + strcpy(path, home); + strcat(path, SEP); + strcat(path, "GNUstep"); } } printf("%s", path);