Bug 308838 - Seamonkey win32 installer builds fail to launch after installation (GRE badness) r=darin

This commit is contained in:
bsmedberg%covad.net 2005-09-29 20:01:42 +00:00
Родитель 7c327edbb0
Коммит 1465d42303
2 изменённых файлов: 37 добавлений и 61 удалений

Просмотреть файл

@ -265,15 +265,15 @@ GRE_GetCurrentProcessDirectory(char* buffer)
* to compute it multiple times.
*/
static char sGRELocation[MAXPATHLEN] = "";
static char sXPCOMPath[MAXPATHLEN] = "";
extern "C" char const *
GRE_GetGREPath()
GRE_GetXPCOMPath()
{
// we've already done this...
if (*sGRELocation)
return sGRELocation;
if (*sXPCOMPath)
return sXPCOMPath;
char buffer[MAXPATHLEN];
// If the xpcom library exists in the current process directory,
@ -289,8 +289,8 @@ GRE_GetGREPath()
if (statResult != -1) {
//found our xpcom lib in the current process directory
buffer[pathlen] = '\0';
strcpy(sGRELocation, buffer);
return sGRELocation;
strcpy(sXPCOMPath, buffer);
return sXPCOMPath;
}
}
@ -301,9 +301,9 @@ GRE_GetGREPath()
GRE_GetGREPathWithProperties(&version, 1,
nsnull, 0,
sGRELocation, MAXPATHLEN);
if (*sGRELocation)
return sGRELocation;
sXPCOMPath, MAXPATHLEN);
if (*sXPCOMPath)
return sXPCOMPath;
return nsnull;
}
@ -317,36 +317,21 @@ GRE_GetGREDirectory(nsILocalFile* *_retval)
// Get the path of the GRE which is compatible with our embedding application
// from the registry
const char *pGREDir = GRE_GetGREPath();
if(pGREDir) {
nsCOMPtr<nsILocalFile> tempLocal;
nsEmbedCString leaf;
NS_CStringSetData(leaf, pGREDir);
rv = NS_NewNativeLocalFile(leaf, PR_TRUE, getter_AddRefs(tempLocal));
const char *pGREDir = GRE_GetXPCOMPath();
if(!pGREDir)
return NS_ERROR_FAILURE;
if (NS_SUCCEEDED(rv)) {
*_retval = tempLocal;
NS_ADDREF(*_retval);
}
}
return rv;
}
static char sXPCOMPath[MAXPATHLEN];
extern "C" const char*
GRE_GetXPCOMPath()
{
const char* grePath = GRE_GetGREPath();
if (!grePath) {
grePath = getenv("MOZILLA_FIVE_HOME");
if (!grePath || !*grePath) {
return nsnull;
}
}
sprintf(sXPCOMPath, "%s" XPCOM_FILE_PATH_SEPARATOR XPCOM_DLL, grePath);
return sXPCOMPath;
nsCOMPtr<nsILocalFile> xpcomPath;
nsEmbedCString leaf(pGREDir);
rv = NS_NewNativeLocalFile(leaf, PR_TRUE, getter_AddRefs(xpcomPath));
if (NS_FAILED(rv))
return rv;
nsCOMPtr<nsIFile> directory;
rv = xpcomPath->GetParent(getter_AddRefs(directory));
if (NS_FAILED(rv))
return rv;
return CallQueryInterface(directory, _retval);
}

Просмотреть файл

@ -61,7 +61,8 @@ struct GREProperty {
};
/**
* Locate the path of a GRE with certain properties.
* Locate the path of the xpcom shared library from a GRE with specified
* properties.
*
* @param versions An array of version ranges: if any version range
* matches, the GRE is considered acceptable.
@ -110,20 +111,22 @@ XPCOMGlueShutdown();
/**
* Locate the path of a compatible GRE. This looks for the GRE version in
* Locate the path of the XPCOM shared library of a compatible GRE.
* The result of this function is normally passed directly to
* XPCOMGlueStartup. This looks for the GRE version in
* nsBuildID.h, which is generated at build time. Unless you set
* MOZ_MILESTONE_RELEASE this will probably not be a useful GRE version string.
*
* @return string buffer pointing to the GRE path (without a trailing
* directory separator). Callers do not need to free this buffer.
*
* @return string buffer pointing to the XPCOM DLL path. Callers do
* not need to free this buffer.
* @status DEPRECATED - Use GRE_GetGREPathWithProperties
*/
extern "C" NS_HIDDEN_(char const *)
GRE_GetGREPath();
GRE_GetXPCOMPath();
/**
* Locate the path of a compatible GRE. This is returned as an
* nsILocalFile instead of a char*.
* Locate the directory of a compatible GRE as an nsIFile
*
* @param _retval Ordinary XPCOM getter, returns an addrefed interface.
*/
@ -131,18 +134,6 @@ extern "C" NS_HIDDEN_(nsresult)
GRE_GetGREDirectory(nsILocalFile* *_retval);
/**
* Locate the path of the XPCOM binary of a compatible GRE.
* The result of this function is normally passed directly to
* XPCOMGlueStartup.
*
* @return string buffer pointing to the XPCOM DLL path. Callers do
* not need to free this buffer.
*/
extern "C" NS_HIDDEN_(char const *)
GRE_GetXPCOMPath();
/**
* Embedding applications which don't need a custom
* directoryserviceprovider may use GRE_Startup to start the XPCOM