Create a new directory at this given path.
(self, mode=0o777, parents=False, exist_ok=False)
| 1448 | os.close(fd) |
| 1449 | |
| 1450 | def mkdir(self, mode=0o777, parents=False, exist_ok=False): |
| 1451 | """ |
| 1452 | Create a new directory at this given path. |
| 1453 | """ |
| 1454 | if self._closed: |
| 1455 | self._raise_closed() |
| 1456 | |
| 1457 | def _try_func(): |
| 1458 | self._accessor.mkdir(self, mode) |
| 1459 | |
| 1460 | def _exc_func(exc): |
| 1461 | if not parents or self.parent == self: |
| 1462 | raise exc |
| 1463 | self.parent.mkdir(parents=True, exist_ok=True) |
| 1464 | self.mkdir(mode, parents=False, exist_ok=exist_ok) |
| 1465 | |
| 1466 | try: |
| 1467 | _try_except_filenotfounderror(_try_func, _exc_func) |
| 1468 | except OSError: |
| 1469 | if not exist_ok or not self.is_dir(): |
| 1470 | raise |
| 1471 | |
| 1472 | def chmod(self, mode): |
| 1473 | """ |
no test coverage detected