From 81abd0ee49e80025043458cd66fada54d5503c7c Mon Sep 17 00:00:00 2001 From: jxxghp Date: Sun, 11 Jun 2023 11:31:36 +0800 Subject: [PATCH] fix list_files_with_extensions --- app/utils/system.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/utils/system.py b/app/utils/system.py index 9b4ae625..f8b3b7f5 100644 --- a/app/utils/system.py +++ b/app/utils/system.py @@ -88,6 +88,12 @@ class SystemUtils: @staticmethod def list_files_with_extensions(directory: Path, extensions: list) -> List[Path]: + """ + 获取目录下所有指定扩展名的文件 + """ + if directory.is_file(): + return [directory] + files = [] pattern = r".*(" + "|".join(extensions) + ")$"