public function extension($extension = false)
    {
        if($extension === false) {
            return $this->adapter->extension($this->path);
        }

        $newName = $this->name();
        $index = strrpos($newName, '.');
        if ($index !== false) {
            $newName = substr($newName, 0, $index + 1);
        } else {
            $newName .= '.';
        }
        $newName .= $extension;

        return $this->name($newName);
    }