/** * Returns a key that may represent a relative path * relative to $this->path as an absolute path * @param boolean $ensure_exists throw exception if final path does not exist * @return string */ public function getAsAbsolutePath($key, $ensure_exists = true) { $path = $this->get($key); if (!$path) { throw new \Exception("Configuration key `{$key}` not found in `{$this->path}`."); } if (!FS::isAbsolutePath($path)) { $path = realpath(FS::join(dirname($this->path), $path)); } if ($ensure_exists && !file_exists($path)) { throw new \Exception("File or folder `{$path}` doesn't exist!"); } return $path; }