protected function getFilenameRelativeToRoot($root_path)
    {
        // strip path from filename
        $result = ltrim(
            substr($this->getPathname(), strlen($root_path)),
            DIRECTORY_SEPARATOR
        );

        if ($result === '') {
            throw new \InvalidArgumentException(
                'File "' . $this->getPathname() . '" is not present in the '
                .'given root: ' . $root_path
            );
        }

        return $result;
    }