release: 0.2.2 fix post-install packaging and robustness
This commit is contained in:
@@ -19,8 +19,18 @@ def list_directories(path: Path, show_hidden: bool = False) -> list[DirectoryEnt
|
||||
directory_path = path.expanduser().resolve()
|
||||
entries: list[DirectoryEntry] = []
|
||||
|
||||
for child in directory_path.iterdir():
|
||||
if not child.is_dir():
|
||||
try:
|
||||
children = list(directory_path.iterdir())
|
||||
except PermissionError:
|
||||
return []
|
||||
|
||||
for child in children:
|
||||
try:
|
||||
is_directory = child.is_dir()
|
||||
except OSError:
|
||||
continue
|
||||
|
||||
if not is_directory:
|
||||
continue
|
||||
if not show_hidden and child.name.startswith("."):
|
||||
continue
|
||||
@@ -41,8 +51,18 @@ def has_subdirectories(path: Path, show_hidden: bool = False) -> bool:
|
||||
|
||||
directory_path = path.expanduser().resolve()
|
||||
|
||||
for child in directory_path.iterdir():
|
||||
if not child.is_dir():
|
||||
try:
|
||||
children = list(directory_path.iterdir())
|
||||
except PermissionError:
|
||||
return False
|
||||
|
||||
for child in children:
|
||||
try:
|
||||
is_directory = child.is_dir()
|
||||
except OSError:
|
||||
continue
|
||||
|
||||
if not is_directory:
|
||||
continue
|
||||
|
||||
if not show_hidden and child.name.startswith("."):
|
||||
|
||||
Reference in New Issue
Block a user