diff --git a/xpcom/build/nsXPComInit.cpp b/xpcom/build/nsXPComInit.cpp index a65f3ef9001..b287f39c9b9 100644 --- a/xpcom/build/nsXPComInit.cpp +++ b/xpcom/build/nsXPComInit.cpp @@ -422,34 +422,33 @@ NS_InitXPCOM2(nsIServiceManager* *result, if (NS_FAILED(rv)) return rv; - nsCOMPtr xpcomLib; - PRBool value; + if (binDirectory) { rv = binDirectory->IsDirectory(&value); if (NS_SUCCEEDED(rv) && value) { nsDirectoryService::gService->Set(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, binDirectory); - binDirectory->Clone(getter_AddRefs(xpcomLib)); } } - else { - nsDirectoryService::gService->Get(NS_XPCOM_CURRENT_PROCESS_DIR, - NS_GET_IID(nsIFile), - getter_AddRefs(xpcomLib)); + + if (appFileLocationProvider) { + rv = nsDirectoryService::gService->RegisterProvider(appFileLocationProvider); + if (NS_FAILED(rv)) return rv; } + nsCOMPtr xpcomLib; + + nsDirectoryService::gService->Get(NS_GRE_DIR, + NS_GET_IID(nsIFile), + getter_AddRefs(xpcomLib)); + if (xpcomLib) { xpcomLib->AppendNative(nsDependentCString(XPCOM_DLL)); nsDirectoryService::gService->Set(NS_XPCOM_LIBRARY_FILE, xpcomLib); } - if (appFileLocationProvider) { - rv = nsDirectoryService::gService->RegisterProvider(appFileLocationProvider); - if (NS_FAILED(rv)) return rv; - } - NS_TIME_FUNCTION_MARK("Next: Omnijar init"); if (!mozilla::Omnijar::IsInitialized()) {