diff --git a/lib/Pico.php b/lib/Pico.php index 0aed209..2deeb80 100644 --- a/lib/Pico.php +++ b/lib/Pico.php @@ -74,6 +74,14 @@ class Pico */ protected $rootDir; + /** + * Vendor directory of this Pico instance + * + * @see Pico::getVendorDir() + * @var string + */ + protected $vendorDir; + /** * Config directory of this Pico instance * @@ -262,6 +270,7 @@ class Pico public function __construct($rootDir, $configDir, $pluginsDir, $themesDir) { $this->rootDir = rtrim($rootDir, '/\\') . '/'; + $this->vendorDir = dirname(__DIR__) . '/'; $this->configDir = $this->getAbsolutePath($configDir); $this->pluginsDir = $this->getAbsolutePath($pluginsDir); $this->themesDir = $this->getAbsolutePath($themesDir); @@ -277,6 +286,16 @@ class Pico return $this->rootDir; } + /** + * Returns the vendor directory of this Pico instance + * + * @return string vendor directory path + */ + public function getVendorDir() + { + return $this->vendorDir; + } + /** * Returns the config directory of this Pico instance * @@ -744,8 +763,10 @@ class Pico // try to guess the content directory if (is_dir($this->getRootDir() . 'content')) { $this->config['content_dir'] = $this->getRootDir() . 'content/'; - } else { + } elseif (is_dir($this->getRootDir() . 'content-sample')) { $this->config['content_dir'] = $this->getRootDir() . 'content-sample/'; + } else { + $this->config['content_dir'] = $this->getVendorDir() . 'content-sample/'; } } else { $this->config['content_dir'] = $this->getAbsolutePath($this->config['content_dir']);