--- fbconnect.module.old	2009-05-08 12:12:23.000000000 -0400
+++ fbconnect.module	2009-05-08 13:03:17.000000000 -0400
@@ -505,24 +505,27 @@
   if (!$fb instanceof Facebook) {
     if ($conf = fbconnect_get_config()) {
       // Facebook php client API
-      $lib_path = drupal_get_path('module', 'fbconnect') .'/facebook-client/';
-      $lib_files = array(
-        'facebook.php',
-        'facebook_desktop.php',
-        'jsonwrapper/jsonwrapper_inner.php',    
-        'jsonwrapper/jsonwrapper.php',
-        'jsonwrapper/JSON/JSON.php'
+      $lib_path = drupal_get_path('module', 'fbconnect') .'/facebook-client';
+      $lib_files_raw = array( //sfyn: we do a file scan directory for each of these files to get around changes to the client library file structure
+        'facebook.php' => file_scan_directory ($lib_path,'facebook.php',array('.', '..', 'CVS'),0,TRUE,'basename'),
+        'facebook_desktop.php' => file_scan_directory ($lib_path,'facebook_desktop.php',array('.', '..', 'CVS'),0,TRUE,'basename'),
+        'jsonwrapper_inner.php' => file_scan_directory ($lib_path,'jsonwrapper_inner.php',array('.', '..', 'CVS'),0,TRUE,'basename'),    
+        'jsonwrapper.php' => file_scan_directory ($lib_path,'jsonwrapper.php',array('.', '..', 'CVS'),0,TRUE,'basename'),
+        'JSON.php' => file_scan_directory ($lib_path,'JSON.php',array('.', '..', 'CVS'),0,TRUE,'basename')
       );
       
-      foreach ($lib_files as $files) {
-        if (!file_exists($lib_path.$files)) {
+      $lib_files = array();
+      foreach ($lib_files_raw as $key => $files) {
+        if (!file_exists('./'.$files[$key]->filename)) { //sfyn: switched $lib_paths out for the ./ - the ./ is necessary because of how file_exists works
           drupal_set_message(t('Fbconnect : Facebook PHP library file @file not found see readme.txt', 
-            array('@file' => $files)), 'status', FALSE);
+            array('@file' => $files[$key]->filename)), 'status', FALSE);
           return;
+        } else { //sfyn: we are going to rebuild $lib_files so that it has the appropriate values
+          $lib_files[$key] = $files[$key]->filename;
         }
       }
       // Include facebook.php
-      include_once($lib_path.$lib_files[0]);
+      include_once($lib_files['facebook.php']); //sfyn: remove $lib_path again
       if (class_exists('Facebook')) {
         $fb = new Facebook($conf['api_key'], $conf['secret_api_key']);
       }
@@ -654,4 +657,4 @@
  */
 function fbconnect_render_fb_favicon() {
   return theme_image(drupal_get_path('module', 'fbconnect') .'/images/favicon.gif');
-}
\ No newline at end of file
+}
