Index: libraries.api.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/libraries/libraries.api.php,v retrieving revision 1.2 diff -u -p -r1.2 libraries.api.php --- libraries.api.php 23 Jul 2010 12:57:01 -0000 1.2 +++ libraries.api.php 25 Aug 2010 00:08:53 -0000 @@ -20,6 +20,9 @@ * - path: (optional) A relative path from the directory of the library to the * actual library. Only required if the extracted download package contains * the actual library files in a sub-directory. + * - external: (optional) A boolean indicating whether the library contains + * external files. In case of multiple variants, of which some declare + * external files and some do not, set this to TRUE. * - version callback: (optional) The name of a function that detects and * returns the full version string of the library. Defaults to * libraries_get_version(). The first argument is always $library, an array Index: libraries.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/libraries/libraries.module,v retrieving revision 1.6 diff -u -p -r1.6 libraries.module --- libraries.module 23 Jul 2010 12:57:01 -0000 1.6 +++ libraries.module 25 Aug 2010 00:08:54 -0000 @@ -146,6 +146,7 @@ function libraries_info($library = NULL) 'vendor url' => '', 'download url' => '', 'path' => '', + 'external' => FALSE, 'version callback' => 'libraries_get_version', 'version arguments' => array(), 'files' => array(), @@ -208,7 +209,7 @@ function libraries_detect_library(&$libr if (!isset($library['library path'])) { $library['library path'] = libraries_get_path($name); } - if (!file_exists($library['library path'])) { + if (!$library['external'] && !file_exists($library['library path'])) { $library['error'] = t('%library could not be found.', array('%library' => $library['title'])); return; } @@ -291,6 +292,9 @@ function libraries_detect_library(&$libr function libraries_load($library, $variant = NULL) { $library = libraries_info($library); libraries_detect_library($library); + if (!$library['installed']) { + return $library['error']; + } libraries_load_files($library, $variant); } @@ -308,7 +312,7 @@ function libraries_load_files($library, // If a variant was specified, override the top-level properties with the // variant properties. - if (!empty($variant) && !empty($library['variants'][$variant]['installed'])) { + if (!empty($variant) && $library['variants'][$variant]['installed']) { $library = array_merge($library, $library['variants'][$variant]); }