diff --git a/README.txt b/README.txt index 7f0d7a1..3339bab 100644 --- a/README.txt +++ b/README.txt @@ -2,13 +2,12 @@ This module requires the 3rd party library for FullCalendar located at http://arshaw.com/fullcalendar. Download the most recent version of the plugin. When unzipped, the plugin -contains several directories. The fullcalendar/fullcalendar directory should be -moved to sites/all/libraries/fullcalendar -(e.g., sites/all/libraries/fullcalendar/fullcalendar.min.js). Do not include -the demos or jQuery directories. +contains several directories. Place the full fullcalendar directory in +sites/all/libraries/fullcalendar, resulting in e.g. the following file: +sites/all/libraries/fullcalendar/fullcalendar/fullcalendar.min.js). If you are using drush, using `drush fullcalendar-plugin` will download the -correct version of the plugin and move the files accordingly. +correct version of the plugin. To use the FullCalendar module: 1) Install Views, Date, Date API, and Date Views modules diff --git a/fullcalendar.module b/fullcalendar.module index 412a255..922694b 100644 --- a/fullcalendar.module +++ b/fullcalendar.module @@ -9,7 +9,21 @@ * The default path to the FullCalendar plugin. */ function fullcalendar_default_path() { - return module_exists('libraries') ? libraries_get_path('fullcalendar') : 'sites/all/libraries/fullcalendar'; + // First try the proper path, with library file structure intact. + $path = module_exists('libraries') ? libraries_get_path('fullcalendar') . '/fullcalendar' : 'sites/all/libraries/fullcalendar/fullcalendar'; + if (file_exists($path . '/fullcalendar.min.js')) { + return $path; + } + + // Next, try the old path, with library moved into the root library folder for + // fullcalendar. + $path = module_exists('libraries') ? libraries_get_path('fullcalendar') : 'sites/all/libraries/fullcalendar'; + if (file_exists($path . '/fullcalendar.min.js')) { + return $path; + } + + // If none are found, return FALSE. + return FALSE; } /**