indexerror finding filesystem root

This commit is contained in:
sneakers-the-rat 2024-09-25 16:58:50 -07:00
parent 5a7e2e2389
commit fe2dbdcd58
Signed by untrusted user who does not match committer: jonny
GPG key ID: 6DCB96EF1E4D232D

View file

@ -82,7 +82,11 @@ def test_relative_to_root_dir():
beneath the root directory (eg `/data`) even if they exist beneath the root directory (eg `/data`) even if they exist
""" """
root = Path().resolve().parents[-1] try:
root = Path().resolve().parents[-1]
except IndexError:
root = Path("/").resolve()
test_path = None test_path = None
for path in root.iterdir(): for path in root.iterdir():
if path.is_dir(): if path.is_dir():