From 3926288b7f1d347d7d25eb732b843b377b092ed9 Mon Sep 17 00:00:00 2001 From: Ahao <108321411+Ahaohaohao@users.noreply.github.com> Date: Sat, 17 May 2025 13:15:04 +0800 Subject: [PATCH] fixed an issue with .window-state.json files not being deleted via the NSIS installer (#3530) --- UPDATELOG.md | 1 + src-tauri/packages/windows/installer.nsi | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/UPDATELOG.md b/UPDATELOG.md index 9d2ac50c6..48fb22225 100644 --- a/UPDATELOG.md +++ b/UPDATELOG.md @@ -22,6 +22,7 @@ - 编辑器中连字符问题 - 安装服务模式后无法立即开启 TUN 模式 - 同步更新多语言翻译 + - 修复 .window-state.json 无法删除的问题 #### 新增了: - Mihomo(Meta)内核升级至 1.19.8 diff --git a/src-tauri/packages/windows/installer.nsi b/src-tauri/packages/windows/installer.nsi index 8aab55fe0..dd2aca87c 100644 --- a/src-tauri/packages/windows/installer.nsi +++ b/src-tauri/packages/windows/installer.nsi @@ -761,6 +761,10 @@ SectionEnd Section Install + ;删除 .window-state.json 文件 + SetShellVarContext current + Delete "$APPDATA\io.github.clash-verge-rev.clash-verge-rev\.window-state.json" + SetOutPath $INSTDIR nsExec::Exec 'netsh int tcp res' !insertmacro CheckIfAppIsRunning @@ -916,6 +920,10 @@ FunctionEnd !macroend Section Uninstall + ;删除 .window-state.json 文件 + SetShellVarContext current + Delete "$APPDATA\io.github.clash-verge-rev.clash-verge-rev\.window-state.json" + !insertmacro CheckIfAppIsRunning !insertmacro CheckAllVergeProcesses !insertmacro RemoveVergeService @@ -1004,6 +1012,10 @@ Section Uninstall RmDir /r "$LOCALAPPDATA\${BUNDLEID}" ${EndIf} + ;删除 .window-state.json 文件 + SetShellVarContext current + Delete "$APPDATA\io.github.clash-verge-rev.clash-verge-rev\.window-state.json" + ${GetOptions} $CMDLINE "/P" $R0 IfErrors +2 0 SetAutoClose true @@ -1054,4 +1066,4 @@ Function CreateStartMenuShortcut CreateDirectory "$SMPROGRAMS\$AppStartMenuFolder" CreateShortcut "$SMPROGRAMS\$AppStartMenuFolder\${MAINBINARYNAME}.lnk" "$INSTDIR\${MAINBINARYNAME}.exe" !insertmacro SetLnkAppUserModelId "$SMPROGRAMS\$AppStartMenuFolder\${MAINBINARYNAME}.lnk" -FunctionEnd +FunctionEnd \ No newline at end of file