From 49d966cf50acec191f02752bc29449e592706839 Mon Sep 17 00:00:00 2001 From: Jim Norman Date: Tue, 14 Mar 2006 22:26:49 +0000 Subject: [PATCH] Bug 155529. Detect whether or not Firefox is installed --- CASA.changes | 4 +++ c_adlib/ad_ff/native/ProfileManager.cpp | 48 +++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/CASA.changes b/CASA.changes index 168820a8..ba42af83 100644 --- a/CASA.changes +++ b/CASA.changes @@ -1,3 +1,7 @@ +------------------------------------------------------------------- +Tue Mar 14 15:53:02 MST 2006 - jnorman@novell.com +- Bug 155529. Detect whether or not Firefox is installed + ------------------------------------------------------------------- Thu Mar 9 10:53:02 IST 2006 - smanojna@novell.com diff --git a/c_adlib/ad_ff/native/ProfileManager.cpp b/c_adlib/ad_ff/native/ProfileManager.cpp index 1bfd499c..940aac33 100644 --- a/c_adlib/ad_ff/native/ProfileManager.cpp +++ b/c_adlib/ad_ff/native/ProfileManager.cpp @@ -420,7 +420,8 @@ int ProfileManager::IsStoreAvailable() PrintMessage(MESG_DEBUG, "\n IsStoreAvailable : Checking if firefox and its libraries are present "); - + + libraryPath = GetFirefoxLibPath(); if( !libraryPath ) @@ -429,7 +430,50 @@ int ProfileManager::IsStoreAvailable() return FPM_FALSE; } - // First try to load from the library path then try to load from default lib path + // First check if firefox binary is present.... + // Because on NLD, NSS library is no longer shipped with firefox. + // Hence NSS libraries will still be there even if firefox is removed :) +#ifdef WIN32 + + char *firefox_bin_file = (char*) malloc(strlen(libraryPath)+ strlen("firefox.exe") + 2); + if( !firefox_bin_file ) + { + PrintMessage(MESG_ERROR, "\n IsStoreAvailable : Insufficient memory..malloc failed \n"); + return FPM_FALSE; + } + + strcpy(firefox_bin_file,libraryPath); + strcat(firefox_bin_file,"\\firefox.exe"); + + FILE *firefox_bin = fopen(firefox_bin_file,"r"); + + if( firefox_bin == NULL) + { + PrintMessage(MESG_ERROR, "\n IsStoreAvailable : Failed to find firefox binary file %s\n", firefox_bin_file); + free(firefox_bin_file); + return FPM_FALSE; + } + + free(firefox_bin_file); + fclose(firefox_bin); + +#else + + FILE *firefox_bin = fopen("/usr/bin/firefox","r"); + + if( firefox_bin == NULL) + { + PrintMessage(MESG_ERROR, "\n IsStoreAvailable : Failed to find firefox binary file /usr/bin/firefox \n"); + return FPM_FALSE; + } + + fclose(firefox_bin); +#endif + + + + + // Next try to load from the library path then try to load from default lib path // Here we have to first load all dependent libraries and then // load main library , otherwise face the problems...:)