From 7f66a7aaa1d1205797b1dd6969501d0ea49d1903 Mon Sep 17 00:00:00 2001 From: Johan Date: Mon, 3 Jun 2013 20:41:41 +0200 Subject: [PATCH] Use the proper paths to fetch plugins and themes from. Also use the sourceFolder and targetFolder settings when reading plugins and themes. --- Controller/Component/LessComponent.php | 34 +++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Controller/Component/LessComponent.php b/Controller/Component/LessComponent.php index e56ce94..8ca7357 100644 --- a/Controller/Component/LessComponent.php +++ b/Controller/Component/LessComponent.php @@ -308,18 +308,20 @@ protected function _checkFolders() { * @return void */ protected function _checkThemeFolders() { - $themedDirectory = APP . 'View' . DS . 'Themed'; + foreach (App::path('View') as $viewFolder) { + $themedDirectory = $viewFolder . 'Themed'; - $folder = new Folder($themedDirectory); - list($themes, $files) = $folder->read(); + $folder = new Folder($themedDirectory); + list($themes, $files) = $folder->read(); - foreach ($themes as $theme) { - $lessDir = $themedDirectory . DS . $theme . DS . 'less'; - $cssDir = $themedDirectory . DS . $theme . DS . 'webroot' . DS . 'css'; + foreach ($themes as $theme) { + $lessDir = $themedDirectory . DS . $theme . DS . $this->settings['sourceFolder']; + $cssDir = $themedDirectory . DS . $theme . DS . 'webroot' . DS . $this->settings['targetFolder']; - if ($theme != '.svn' && is_dir($lessDir) && is_dir($cssDir)) { - $this->_lessFolders[$theme] = new Folder($lessDir); - $this->_cssFolders[$theme] = new Folder($cssDir); + if ($theme[0] != '.' && is_dir($lessDir) && is_dir($cssDir)) { + $this->_lessFolders[$theme] = new Folder($lessDir); + $this->_cssFolders[$theme] = new Folder($cssDir); + } } } } @@ -330,15 +332,13 @@ protected function _checkThemeFolders() { * @return void */ protected function _checkPluginFolders() { - $pluginDirectory = APP . 'Plugin'; - - $folder = new Folder($pluginDirectory); - list($plugins, $files) = $folder->read(); + $plugins = CakePlugin::loaded(); foreach ($plugins as $plugin) { - $lessDir = $pluginDirectory . DS . $plugin . DS . 'less'; - $cssDir = $pluginDirectory . DS . $plugin . DS . 'webroot' . DS . 'css'; - if ($plugin != '.svn' && is_dir($lessDir) && is_dir($cssDir)) { + $pluginPath = App::pluginPath($plugin); + $lessDir = $pluginPath . $this->settings['sourceFolder']; + $cssDir = $pluginPath . WEBROOT_DIR . DS . $this->settings['targetFolder']; + if (is_dir($lessDir) && is_dir($cssDir)) { $this->_lessFolders[$plugin] = new Folder($lessDir); $this->_cssFolders[$plugin] = new Folder($cssDir); } @@ -477,4 +477,4 @@ public function cleanGeneratedCss() { return $cleanedFiles; } -} \ No newline at end of file +}