From f7478041392adb1a3b381f2d749b9e26247c725e Mon Sep 17 00:00:00 2001 From: skymkmk Date: Sun, 5 Mar 2023 15:50:58 +0800 Subject: [PATCH] perf: optimize existing folder detection logic --- src/init.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/init.py b/src/init.py index 21658f7..a6e47d3 100644 --- a/src/init.py +++ b/src/init.py @@ -27,7 +27,7 @@ def init(config: dict): # New save path if not exists if not os.path.exists(config['save_path']): os.makedirs(config['save_path']) - dirs = os.listdir(config['save_path']) + dirs = [i for i in os.listdir(config['save_path']) if os.path.isdir(os.path.join(config['save_path'], i))] tmp = [] # Detect unrelated pages for i in dirs: