fix: Attempt to check if a directory is empty faster.

pull/798/head
Raphaël Vinot 2023-10-02 16:16:22 +02:00
parent f250cba632
commit e3b85508f1
1 changed files with 1 additions and 1 deletions

View File

@ -54,7 +54,7 @@ class Archiver(AbstractManager):
def _update_index(self, root_dir: Path) -> None:
current_index: Dict[str, str] = {}
if not os.listdir(root_dir):
if not any(os.scandir(root_dir)):
# the directory is empty, we can safely remove it
root_dir.rmdir()
return