Bug 301043 - SeaMonkey application quits immediately after launch (installer with GRE only), r=darin, self-approved (seamonkey only)

This commit is contained in:
bsmedberg%covad.net 2005-07-26 14:12:38 +00:00
parent 39e056ccb5
commit 151a6eac74

View File

@ -51,7 +51,7 @@
#ifdef XP_WIN
#include <windows.h>
#include <mbstring.h>
#include <malloc.h>
#define snprintf _snprintf
#endif
@ -467,6 +467,27 @@ nsresult GRE_Startup()
return rv;
}
#ifdef XP_WIN
// On windows we have legacy GRE code that does not load the GRE dependent
// libs (seamonkey GRE, not libxul)... add the GRE to the PATH.
// See bug 301043.
char *lastSlash = strrchr(xpcomLocation, '\\');
if (lastSlash) {
int xpcomPathLen = lastSlash - xpcomLocation;
DWORD pathLen = GetEnvironmentVariable("PATH", nsnull, 0);
char *newPath = (char*) _alloca(xpcomPathLen + pathLen + 1);
strncpy(newPath, xpcomLocation, xpcomPathLen);
// in case GetEnvironmentVariable fails
newPath[xpcomPathLen] = ';';
newPath[xpcomPathLen + 1] = '\0';
GetEnvironmentVariable("PATH", newPath + xpcomPathLen + 1, pathLen);
SetEnvironmentVariable("PATH", newPath);
}
#endif
nsGREDirServiceProvider *provider = new nsGREDirServiceProvider();
if ( !provider ) {
NS_WARNING("GRE_Startup failed");