[patch] 处理DY安装包打包后图片视频暂存路径部分权限问题 处理编码问题
This commit is contained in:
@@ -312,12 +312,33 @@ if NOT ERRORLEVEL 1 (
|
|||||||
set /a count+=1
|
set /a count+=1
|
||||||
goto wait_main_exit
|
goto wait_main_exit
|
||||||
) else (
|
) else (
|
||||||
echo WARN: Main program did not exit normally, forcing installation
|
echo WARN: Main program did not exit normally, forcing termination
|
||||||
|
taskkill /F /IM {exe_name} 2>nul
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
echo OK: Main program exited
|
echo OK: Main program exited
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
|
REM Critical fix: Wait 2 seconds to ensure all file handles are released
|
||||||
|
echo INFO: Waiting for file handles to release...
|
||||||
|
timeout /t 2 /nobreak > nul
|
||||||
|
echo OK: File handles released
|
||||||
|
echo.
|
||||||
|
|
||||||
|
REM Critical fix: Delete old _internal directory to force clean install
|
||||||
|
echo INFO: Removing old _internal directory...
|
||||||
|
if exist "{install_dir}\\_internal" (
|
||||||
|
rd /s /q "{install_dir}\\_internal" 2>nul
|
||||||
|
if exist "{install_dir}\\_internal" (
|
||||||
|
echo WARN: Failed to delete _internal directory
|
||||||
|
) else (
|
||||||
|
echo OK: Old _internal directory removed successfully
|
||||||
|
)
|
||||||
|
) else (
|
||||||
|
echo INFO: No old _internal directory found
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
|
||||||
REM Execute NSIS silent installation
|
REM Execute NSIS silent installation
|
||||||
echo INFO: Starting installation...
|
echo INFO: Starting installation...
|
||||||
echo INFO: Installer: "{installer_path}"
|
echo INFO: Installer: "{installer_path}"
|
||||||
@@ -327,9 +348,9 @@ echo.
|
|||||||
REM Execute installation (with admin rights from NSIS)
|
REM Execute installation (with admin rights from NSIS)
|
||||||
"{installer_path}" /S /D={install_dir}
|
"{installer_path}" /S /D={install_dir}
|
||||||
|
|
||||||
REM Wait for installation to complete
|
REM Wait for installation to complete (extended to 35 seconds for full copy)
|
||||||
echo INFO: Waiting for installation to complete...
|
echo INFO: Waiting for installation to complete...
|
||||||
timeout /t 25 /nobreak > nul
|
timeout /t 35 /nobreak > nul
|
||||||
|
|
||||||
REM Cleanup installer
|
REM Cleanup installer
|
||||||
echo INFO: Cleaning up installer...
|
echo INFO: Cleaning up installer...
|
||||||
@@ -384,13 +405,13 @@ def create_restart_launcher(install_dir, exe_name):
|
|||||||
# 构建批处理脚本
|
# 构建批处理脚本
|
||||||
script_content = f"""@echo off
|
script_content = f"""@echo off
|
||||||
chcp 65001 > nul
|
chcp 65001 > nul
|
||||||
title 水滴AI客服智能助手 - 更新助手
|
title ShuiDi AI Assistant - Update Helper
|
||||||
|
|
||||||
echo [%time%] 正在更新水滴AI客服智能助手...
|
echo [%time%] Updating ShuiDi AI Assistant...
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
REM 等待主程序退出(最多等待10秒)
|
REM Wait for main program to exit (max 10 seconds)
|
||||||
echo [%time%] 等待主程序退出...
|
echo [%time%] Waiting for main program to exit...
|
||||||
set count=0
|
set count=0
|
||||||
:wait_main_exit
|
:wait_main_exit
|
||||||
tasklist /FI "IMAGENAME eq {exe_name}" 2>NUL | find /I "{exe_name}" >NUL
|
tasklist /FI "IMAGENAME eq {exe_name}" 2>NUL | find /I "{exe_name}" >NUL
|
||||||
@@ -401,40 +422,40 @@ if NOT ERRORLEVEL 1 (
|
|||||||
goto wait_main_exit
|
goto wait_main_exit
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
echo [%time%] 主程序已退出
|
echo [%time%] Main program exited
|
||||||
|
|
||||||
REM 等待安装完成(15秒)
|
REM Wait for installation to complete (15 seconds)
|
||||||
echo [%time%] 等待安装完成...
|
echo [%time%] Waiting for installation to complete...
|
||||||
timeout /t 15 /nobreak > nul
|
timeout /t 15 /nobreak > nul
|
||||||
|
|
||||||
REM 清理旧的安装包
|
REM Clean up old installer files
|
||||||
echo [%time%] 清理临时文件...
|
echo [%time%] Cleaning up temporary files...
|
||||||
del /f /q "%TEMP%\\ShuiDi_AI_Assistant_Setup_*.exe" 2>nul
|
del /f /q "%TEMP%\\ShuiDi_AI_Assistant_Setup_*.exe" 2>nul
|
||||||
|
|
||||||
REM 启动新版本程序
|
REM Start new version
|
||||||
echo [%time%] 正在启动新版本...
|
echo [%time%] Starting new version...
|
||||||
cd /d "{install_dir}"
|
cd /d "{install_dir}"
|
||||||
if exist "{exe_name}" (
|
if exist "{exe_name}" (
|
||||||
start "" "{install_dir}\\{exe_name}"
|
start "" "{install_dir}\\{exe_name}"
|
||||||
echo [%time%] ✅ 程序已启动
|
echo [%time%] Program started successfully
|
||||||
) else (
|
) else (
|
||||||
echo [%time%] ❌ 错误: 找不到程序文件 {exe_name}
|
echo [%time%] ERROR: Program file not found: {exe_name}
|
||||||
pause
|
pause
|
||||||
)
|
)
|
||||||
|
|
||||||
REM 延迟后删除自己
|
REM Delete this script after delay
|
||||||
timeout /t 2 /nobreak > nul
|
timeout /t 2 /nobreak > nul
|
||||||
del /f /q "%~f0" 2>nul
|
del /f /q "%~f0" 2>nul
|
||||||
exit
|
exit
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# 写入脚本文件(UTF-8 BOM编码,避免中文乱码)
|
# Write script file with UTF-8 BOM encoding
|
||||||
try:
|
try:
|
||||||
with open(script_path, 'w', encoding='utf-8-sig') as f:
|
with open(script_path, 'w', encoding='utf-8-sig') as f:
|
||||||
f.write(script_content)
|
f.write(script_content)
|
||||||
print(f"[Updater] 重启启动器已创建: {script_path}")
|
print(f"[Updater] Restart launcher created: {script_path}")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[Updater] 创建重启启动器失败: {e}")
|
print(f"[Updater] Failed to create restart launcher: {e}")
|
||||||
|
|
||||||
return script_path
|
return script_path
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user