Bug 155529. Detect whether or not Firefox is installed
This commit is contained in:
@@ -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...:)
|
||||
|
||||
Reference in New Issue
Block a user