From bbd155b917f4ef561302be362c0721d6f8ac2d56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=94=E5=BF=B5?= <12574910+72wo@users.noreply.github.com> Date: Tue, 3 Mar 2026 00:19:08 +0800 Subject: [PATCH] =?UTF-8?q?```=20feat(base):=20=E6=9B=B4=E6=96=B0=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E8=84=9A=E6=9C=AC=E4=B8=AD=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=88=A0=E9=99=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 删除旧文件的逻辑从单一文件删除改为批量删除以 logic_ 开头的所有文件, 同时保留了删除前的确认检查机制 ``` --- modules/base/middleware/server.go | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/modules/base/middleware/server.go b/modules/base/middleware/server.go index a6f86c987..fc098af96 100644 --- a/modules/base/middleware/server.go +++ b/modules/base/middleware/server.go @@ -220,11 +220,19 @@ echo "===== 开始下载程序 =====" echo "下载链接:%s{file_url}" echo "目标路径:%s{exe_path}" -# 删除旧文件 -if [ -f "%s{exe_path}" ]; then - echo "删除旧文件:%s{exe_path}" - rm -f "%s{exe_path}" -fi +# 定义要删除文件的目录(根据你的实际路径修改,比如 /usr/local/game/ 或当前目录 .) +target_dir="." + +# 删除所有 logic_ 开头的文件 +echo "开始删除 ${target_dir} 目录下 logic_ 开头的文件..." +for file in "${target_dir}"/logic_*; do + # 检查文件是否存在(避免匹配不到时删除空值) + if [ -f "$file" ]; then + echo "删除旧文件:$file" + rm -f "$file" + fi +done +echo "logic_ 开头的文件删除完成" # ===== 准备下载目录 ===== echo "创建工作目录:%s{work_dir}"