public function getPathObject($name)
    {
        if ($this->callerNotSelf()) {
            Deprecated::method(3.3, 'Use Bolt\Filesystem (recommended) or PathResolver::resolve instead.');
        }

        $name = str_replace('\\', '/', $name);

        $parts = [];
        if (strpos($name, '/') !== false) {
            $parts = explode('/', $name);
            $name = array_shift($parts);
        }

        if (!$this->configInitialized && in_array($name, ['theme', 'themepath', 'templates', 'templatespath'])) {
            $this->initializeConfig();
        }

        if (array_key_exists($name . 'path', $this->paths)) {
            $path = $this->paths[$name . 'path'];
        } elseif (array_key_exists($name, $this->paths)) {
            $path = $this->paths[$name];
        } else {
            throw new \InvalidArgumentException("Requested path $name is not available", 1);
        }

        if (is_callable($path)) {
            $path = $path();
        }

        if (!empty($parts)) {
            $path = $path->joinAtomSequence($parts);
        }

        return $path;
    }