protected function isDirectory($path)
    {
        $location = $this->applyPathPrefix($path);

        if (empty($location)) {
            return true;
        }

        try {
            $file = $this->share->stat($location);
        } catch (NotFoundException $e) {
            return false;
        }

        return $file->isDirectory();
    }