From 1221945da8de8801d539a5eb4312f8ebb1b0f929 Mon Sep 17 00:00:00 2001 From: Olivia Kinnear <51250849+superatomic@users.noreply.github.com> Date: Mon, 4 Sep 2023 22:18:47 -0500 Subject: [PATCH] Display directories first in error when cache contains non-cache files --- src/tldr_man/pages.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tldr_man/pages.py b/src/tldr_man/pages.py index 8a6f2bf..9df5650 100644 --- a/src/tldr_man/pages.py +++ b/src/tldr_man/pages.py @@ -225,7 +225,7 @@ def ensure_cache_dir_update_safety(): return problematic_files = [' ' + format_filename(path) + ('/' if path.is_dir() else '') - for path in sorted(CACHE_DIR.iterdir(), key=lambda path: (path.is_dir(), path.name)) + for path in sorted(CACHE_DIR.iterdir(), key=lambda path: (path.is_file(), path.name)) if not (path.is_dir() and EXPECTED_CACHE_CONTENT_PATTERN.match(path.name))] if problematic_files: