This commit is contained in:
HuangHai
2026-01-25 10:07:19 +08:00
parent b514bd2812
commit 9071c0aa72
18 changed files with 189 additions and 98 deletions

View File

@@ -39,7 +39,17 @@ def mark_input_box():
return
screenshot_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), "Screenshots")
if not os.path.exists(screenshot_dir):
if os.path.exists(screenshot_dir):
# 清空目录
logger.info(f"正在清空截图目录: {screenshot_dir}")
for f in os.listdir(screenshot_dir):
file_path = os.path.join(screenshot_dir, f)
try:
if os.path.isfile(file_path):
os.unlink(file_path)
except Exception as e:
logger.warning(f"删除文件失败 {file_path}: {e}")
else:
os.makedirs(screenshot_dir)
timestamp = time.strftime("%Y%m%d_%H%M%S")