diff --git a/tosfs/core.py b/tosfs/core.py index 6a54c0a..4e7c06a 100644 --- a/tosfs/core.py +++ b/tosfs/core.py @@ -499,9 +499,10 @@ def makedirs(self, path: str, exist_ok: bool = False) -> None: """ path = self._strip_protocol(path).rstrip("/") + "/" - if exist_ok and self.exists(path): + path_exist = self.exists(path) + if exist_ok and path_exist: return - if not exist_ok and self.exists(path): + if not exist_ok and path_exist: raise FileExistsError(path) self.mkdir(path, create_parents=True)