public function getChild($relPath)
{
// Use attached repository if possible
if ($this->getRepository()) {
return $this->getRepository()->get($this->getRepositoryPath() . '/' . $relPath);
}
$filesystemPath = $this->getFilesystemPath() . '/' . $relPath;
if (!file_exists($filesystemPath)) {
throw ResourceNotFoundException::forPath($this->getPath() . '/' . $relPath);
}
$childPath = null === $this->getPath() ? null : $this->getPath() . '/' . $relPath;
return is_dir($filesystemPath) ? new self($filesystemPath, $childPath) : new FileResource($filesystemPath, $childPath);
}