Przeglądaj źródła

Allow to load non-local templates

Olav Schettler 9 lat temu
rodzic
commit
fee4544785
1 zmienionych plików z 4 dodań i 4 usunięć
  1. 4 4
      src/Mustache/Loader/FilesystemLoader.php

+ 4 - 4
src/Mustache/Loader/FilesystemLoader.php

@@ -52,10 +52,10 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
 
         if (strpos($this->baseDir, '://') === false) {
             $this->baseDir = realpath($this->baseDir);
-        }
 
-        if (!is_dir($this->baseDir)) {
-            throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir));
+            if (!is_dir($this->baseDir)) {
+                throw new Mustache_Exception_RuntimeException(sprintf('FilesystemLoader baseDir must be a directory: %s', $baseDir));
+            }
         }
 
         if (array_key_exists('extension', $options)) {
@@ -99,7 +99,7 @@ class Mustache_Loader_FilesystemLoader implements Mustache_Loader
     {
         $fileName = $this->getFileName($name);
 
-        if (!file_exists($fileName)) {
+        if (strpos($this->baseDir, '://') === false && !file_exists($fileName)) {
             throw new Mustache_Exception_UnknownTemplateException($name);
         }