Fix linux builds by giving them a better idea of the executable location

This commit is contained in:
Ben Turner 2009-09-04 00:23:06 -07:00
parent 17a765274c
commit 168680f7ad
2 changed files with 32 additions and 9 deletions

View File

@ -52,6 +52,10 @@
#include "nsWindowsWMain.cpp"
#endif
#if defined(MOZ_WIDGET_GTK2)
#include <gtk/gtk.h>
#endif
int
main(int argc, char* argv[])
{
@ -59,6 +63,10 @@ main(int argc, char* argv[])
MessageBox(NULL, L"Hi", L"Hi", MB_OK);
#endif
#ifdef MOZ_WIDGET_GTK2
gtk_init(0, 0);
#endif
GeckoProcessType proctype =
XRE_StringToChildProcessType(argv[argc - 1]);

View File

@ -579,15 +579,6 @@ NS_InitXPCOM3(nsIServiceManager* *result,
NS_ENSURE_STATE(sExitManager);
}
if ((sCommandLineWasInitialized = !CommandLine::IsInitialized())) {
#ifdef XP_WIN
CommandLine::Init(0, nsnull);
#else
static char const *const argv = { "/really/should/not/exist" };
CommandLine::Init(1, &argv);
#endif
}
if (!MessageLoop::current()) {
sMessageLoop = new MessageLoopForUI();
NS_ENSURE_STATE(sMessageLoop);
@ -667,6 +658,30 @@ NS_InitXPCOM3(nsIServiceManager* *result,
if (NS_FAILED(rv)) return rv;
}
#ifdef MOZ_IPC
if ((sCommandLineWasInitialized = !CommandLine::IsInitialized())) {
#ifdef OS_WIN
CommandLine::Init(0, nsnull);
#else
nsCOMPtr<nsIFile> binaryFile;
nsDirectoryService::gService->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
NS_GET_IID(nsIFile),
getter_AddRefs(binaryFile));
NS_ENSURE_STATE(binaryFile);
rv = binaryFile->AppendNative(NS_LITERAL_CSTRING("nonexistent-executable"));
NS_ENSURE_SUCCESS(rv, rv);
nsCString binaryPath;
rv = binaryFile->GetNativePath(binaryPath);
NS_ENSURE_SUCCESS(rv, rv);
static char const *const argv = { strdup(binaryPath.get()) };
CommandLine::Init(1, &argv);
#endif
}
#endif
NS_ASSERTION(nsComponentManagerImpl::gComponentManager == NULL, "CompMgr not null at init");
// Create the Component/Service Manager