From f623dcc887c1f71289d6f50af73a929343d4b703 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 1 Aug 2010 07:03:50 +0000 Subject: [PATCH] MINOR Fixed path concat issues --- code/DocumentationEntity.php | 6 +++++- code/DocumentationPage.php | 6 +++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/code/DocumentationEntity.php b/code/DocumentationEntity.php index 970b6aa..8ffccd5 100644 --- a/code/DocumentationEntity.php +++ b/code/DocumentationEntity.php @@ -221,6 +221,10 @@ class DocumentationEntity extends ViewableData { $path = $this->versions[$versions[0]]; } - return $path . '/' . $lang .'/'; + return rtrim($path, '/') . '/' . rtrim($lang, '/') .'/'; + } + + function __toString() { + return sprintf('DocumentationEntity: %s)', $this->getPath()); } } \ No newline at end of file diff --git a/code/DocumentationPage.php b/code/DocumentationPage.php index 99cb538..53d8d61 100644 --- a/code/DocumentationPage.php +++ b/code/DocumentationPage.php @@ -30,8 +30,7 @@ class DocumentationPage extends ViewableData { if(!file_exists($this->getPath())) { throw new InvalidArgumentException(sprintf( - 'Path could not be found: "%s" (module path: %s, file path: %s)', - $this->getPath(), + 'Path could not be found. Module path: %s, file path: %s', $this->entity->getPath(), $this->relativePath )); @@ -61,7 +60,8 @@ class DocumentationPage extends ViewableData { * @return String */ function getPath() { - return realpath($this->entity->getPath($this->version, $this->lang) . '/' . $this->getRelativePath()); + $path = rtrim($this->entity->getPath($this->version, $this->lang), '/') . '/' . $this->getRelativePath(); + return realpath($path); } function getLang() {