Bug 798233 - Don't search firefox executable in $exe/../../dist/bin. r=marco

This commit is contained in:
Mike Hommey 2012-11-16 17:12:00 +01:00
parent 219dad47cb
commit b354fd4758
2 changed files with 10 additions and 9 deletions

View File

@ -30,6 +30,8 @@ LIBS = \
$(MOZ_GTK2_LIBS) \
$(NULL)
NSDISTMODE = copy
include $(topsrcdir)/config/rules.mk
CXXFLAGS += \

View File

@ -124,11 +124,14 @@ bool CopyFile(const char* inputFile, const char* outputFile)
return (bytesRead >= 0);
}
bool GRELoadAndLaunch(const char* firefoxDir)
bool GRELoadAndLaunch(const char* firefoxDir, bool silentFail)
{
char xpcomDllPath[MAXPATHLEN];
snprintf(xpcomDllPath, MAXPATHLEN, "%s/%s", firefoxDir, XPCOM_DLL);
if (silentFail && access(xpcomDllPath, F_OK) != 0)
return false;
if (NS_FAILED(XPCOMGlueStartup(xpcomDllPath))) {
ErrorDialog("Couldn't load the XPCOM library");
return false;
@ -327,14 +330,10 @@ int main(int argc, char *argv[])
char firefoxDir[MAXPATHLEN];
// Check if Firefox is in the ../../dist/bin directory (relative to the webapp runtime)
// Check if Firefox is in the same directory as the webapp runtime.
// This is the case for webapprt chrome and content tests.
snprintf(firefoxDir, MAXPATHLEN, "%s/../../dist/bin", curExeDir);
if (access(firefoxDir, F_OK) != -1) {
if (GRELoadAndLaunch(firefoxDir))
return 0;
return 255;
if (GRELoadAndLaunch(curExeDir, true)) {
return 0;
}
// Set up webAppIniPath with path to webapp.ini
@ -391,7 +390,7 @@ int main(int argc, char *argv[])
// If WebAppRT version == Firefox version, load XUL and execute the application
if (!strcmp(buildid, NS_STRINGIFY(GRE_BUILDID))) {
if (GRELoadAndLaunch(firefoxDir))
if (GRELoadAndLaunch(firefoxDir, false))
return 0;
}
// Else, copy WebAppRT from Firefox installation and re-execute the process