Skip to content

Commit fada67c

Browse files
refactor(utils): 优化文件系统工具函数
- 移除未使用的导入 - 修复变量赋值问题 - 优化代码格式
1 parent c1454bb commit fada67c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/utils/file_system_utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from multiprocessing import process
2-
import re
31
from loguru import logger
42
from pathlib import Path
53
import os
@@ -285,7 +283,7 @@ def get_exe_version(path) -> tuple[bool, str]:
285283
# 方法4: 返回文件基本信息
286284
file_stat = file.stat()
287285
file_size = file_stat.st_size / 1024 / 1024 # MB
288-
size += f"{file_size:.2f} MB\n"
286+
size = f"{file_size:.2f} MB\n"
289287

290288
logger.info("无法获取版本信息,返回文件大小")
291289
return True, size
@@ -308,8 +306,8 @@ def check_exe_running(path) -> bool:
308306
Returns:
309307
bool: 正在运行返回True
310308
"""
311-
process = path.rsplit('/', 1)[-1] or path.rsplit('\\', 1)[-1]
312309
try:
310+
process = path.rsplit('/', 1)[-1] or path.rsplit('\\', 1)[-1]
313311
# 在Windows上检查进程
314312
if os.name == 'nt':
315313
result = subprocess.run(

0 commit comments

Comments
 (0)