From 444ecba7a22ef68333756f5cfa4d7430ea661a97 Mon Sep 17 00:00:00 2001
From: Jaime Herencia <jherencia@360690.no-reply.drupal.org>
Date: Tue, 20 Nov 2012 19:23:03 +0100
Subject: [PATCH] Issue #1675964 by jherencia: Helper function for Drush
 command checks the wrong path

---
 drush/modernizr.drush.inc |   13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/drush/modernizr.drush.inc b/drush/modernizr.drush.inc
index 5e62525..4cdbff3 100644
--- a/drush/modernizr.drush.inc
+++ b/drush/modernizr.drush.inc
@@ -77,22 +77,21 @@ function _modernizr_drush_download_dev() {
   else {
     $path = drush_get_context('DRUSH_DRUPAL_ROOT');
     if (module_exists('libraries')) {
-      $path .= '/' . libraries_get_path('modernizr');
+      $libraries_path = libraries_get_path('modernizr');
+      $path .= $libraries_path ? $libraries_path : '/sites/all/libraries/modernizr';
     }
     else {
       $path .= '/' . drupal_get_path('module', 'modernizr') . '/js';
     }
   }
 
-  // Create the path if it does not exist yet.
-  if (!is_dir($path)) {
-    drush_mkdir($path);
-  }
-
   if (is_dir($path)) {
     drush_log('Modernizr already present. No download required.', 'ok');
+    return;
   }
-  elseif (drush_op('chdir', $path) &&
+  // Create the directory
+  drush_mkdir($path);
+  if (drush_op('chdir', $path) &&
     drush_shell_exec('wget '. MODERNIZR_DOWNLOAD_DEV)) {
       drush_log(dt('The latest Modernizr dev library has been downloaded to @path', array('@path' => $path)), 'success');
   }
-- 
1.7.9.6 (Apple Git-31.1)

