public function createDir($name = null)
    {
        unlink($dir = $this->createFile());

        if (false === mkdir($dir)) {
            throw FileSystemException::lastError($dir);
        }

        if (null !== $name) {
            $dir .= DIRECTORY_SEPARATOR . $name;

            if (false === mkdir($dir)) {
                throw FileSystemException::lastError($dir);
            }
        }

        return $dir;
    }