Put back the old pwd code; otherwise it crashes if MOZILLA_HOME isn't set

This commit is contained in:
akkana%netscape.com 1998-11-13 02:49:19 +00:00
parent 0e59484bfd
commit cf2313ec58

View File

@ -1030,8 +1030,34 @@ char *mangleResourceIntoFileURL(const char* aResourceFileName)
{
nsUnixMozillaHomePath = PR_GetEnv(MOZILLA_HOME);
}
if (nsnull == nsUnixMozillaHomePath)
{
static char homepath[MAXPATHLEN];
FILE* pp;
if (!(pp = popen("pwd", "r"))) {
#ifdef DEBUG
printf("RESOURCE protocol error in nsURL::mangeResourceIntoFileURL 1\n");
#endif
return(nsnull);
}
if (fgets(homepath, MAXPATHLEN, pp)) {
homepath[PL_strlen(homepath)-1] = 0;
}
else {
#ifdef DEBUG
printf("RESOURCE protocol error in nsURL::mangeResourceIntoFileURL 2\n");
#endif
pclose(pp);
return(nsnull);
}
pclose(pp);
nsUnixMozillaHomePath = homepath;
}
resourceBase = XP_STRDUP(nsUnixMozillaHomePath);
#ifdef DEBUG
printf("Using '%s' as the resource: base\n", resourceBase);
#endif
#endif /* XP_UNIX */