From c6552d7bf534c47a672104e96290b806198e6f43 Mon Sep 17 00:00:00 2001 From: Llloooggg Date: Thu, 15 May 2025 22:11:24 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=BF=D0=BE=D0=B4=D1=81=D1=87=D0=B5=D1=82=20?= =?UTF-8?q?=D0=B2=D1=81=D0=B5=D0=B3=D0=BE=20=D1=80=D0=B0=D0=B7=D0=BC=D0=B5?= =?UTF-8?q?=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- image_compressor.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/image_compressor.py b/image_compressor.py index 1e03195..a9f1980 100644 --- a/image_compressor.py +++ b/image_compressor.py @@ -54,19 +54,20 @@ def get_tool_path(name: str) -> Path: def get_folder_size(path: Path) -> int: + excluded = { + "image_compressor.exe", + "image_compressor.py", + "image_compressor.db", + "image_compressor.db-journal", + "image_compressor.log", + } total_size = 0 for dirpath, dirnames, filenames in os.walk(path): for filename in filenames: - file_path = os.path.abspath(os.path.join(dirpath, filename)) - if file_path in [ - "image_compressor.exe", - "image_compressor.py", - "image_compressor.db", - "image_compressor.db-journal", - "image_compressor.log", - ]: + if filename in excluded: continue - total_size += os.path.getsize(file_path) + file_path = Path(dirpath) / filename + total_size += file_path.stat().st_size return total_size