Browse Source

Fix double DS in cell paths.

Refs #5217
Mark Story 11 years ago
parent
commit
ebcd5cf935
1 changed files with 6 additions and 3 deletions
  1. 6 3
      src/View/View.php

+ 6 - 3
src/View/View.php

@@ -803,11 +803,14 @@ class View {
  * @throws \Cake\View\Exception\MissingTemplateException when a view file could not be found.
  */
 	protected function _getViewFileName($name = null) {
-		$subDir = null;
+		$viewPath = $subDir = '';
 
 		if ($this->subDir !== null) {
 			$subDir = $this->subDir . DS;
 		}
+		if ($this->viewPath) {
+			$viewPath = $this->viewPath . DS;
+		}
 
 		if ($name === null) {
 			$name = $this->view;
@@ -817,7 +820,7 @@ class View {
 		$name = str_replace('/', DS, $name);
 
 		if (strpos($name, DS) === false && $name[0] !== '.') {
-			$name = $this->viewPath . DS . $subDir . Inflector::underscore($name);
+			$name = $viewPath . $subDir . Inflector::underscore($name);
 		} elseif (strpos($name, DS) !== false) {
 			if ($name[0] === DS || $name[1] === ':') {
 				if (is_file($name)) {
@@ -825,7 +828,7 @@ class View {
 				}
 				$name = trim($name, DS);
 			} elseif (!$plugin || $this->viewPath !== $this->name) {
-				$name = $this->viewPath . DS . $subDir . $name;
+				$name = $viewPath . $subDir . $name;
 			} else {
 				$name = DS . $subDir . $name;
 			}