From dde2cafadf7fa650902fdce32b9bcf165475cdfa Mon Sep 17 00:00:00 2001
From: mrded <ded@pisem.net>
Date: Thu, 24 May 2012 10:36:20 +0100
Subject: [PATCH] Use Library API

---
 README.txt  |    4 ++--
 sass.module |    8 ++++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/README.txt b/README.txt
index def2085..6056411 100644
--- a/README.txt
+++ b/README.txt
@@ -9,10 +9,10 @@ and the examples here http://sass-lang.com/tutorial.html
 
 Installation
 
-1. Create a folder inside the SASS module (sites/all/modules/sass) and name it phamlp
+1. Create a folder inside the SASS module (sites/all/modules/sass) or inside libraries folder (sites/all/libraries) and name it phamlp
 2. Download PHamlP_3.2.zip from http://code.google.com/p/phamlp/downloads/list
 3. Extract its contents to the phamlp folder you just created
-4. Once you have installed/enabled the module you can visit admin/settings/sass where you can
+4. Once you have installed/enabled the module you can visit admin/config/development/sass where you can
 configure various settings surrounding the behavior of this module.
 
 Extras:
diff --git a/sass.module b/sass.module
index 000fca6..cdb4aae 100644
--- a/sass.module
+++ b/sass.module
@@ -74,8 +74,12 @@ function sass_preprocess_page(&$variables) {
   // TODO: move phamlp into library folder (which should be near of themes and modules)
   // $phamlp_library = drupal_get_path('library', 'phamlp');
   // var_dump($phamlp_library);
-
-  $sass_parser_path = dirname(__FILE__) . '/phamlp/sass/SassParser.php';
+  
+  if (module_exists('libraries')) {
+    $sass_parser_path = libraries_get_path('phamlp') . '/sass/SassParser.php';
+  } else {
+    $sass_parser_path = dirname(__FILE__) . '/phamlp/sass/SassParser.php';
+  }
 
   if (!file_exists($sass_parser_path)){
     drupal_set_message(t('SASS module cannot find phaml library. Please upload it in module folder, so  the needed file will be available by this path "@path"',
-- 
1.7.4.4

