Skip to content

Commit

Permalink
feat(nsis-build): allow delete old engine after finish
Browse files Browse the repository at this point in the history
  • Loading branch information
WAY29 committed Sep 26, 2024
1 parent 1c325f9 commit f5fd933
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions build/yakit_build.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Var /Global INSTALL_PATH
Var /Global INSTALL_PATH_REG_KEY_NAME
Var /Global EXE_NAME
Var /Global KEEP_FOLDER
Var /Global DeleteOldEngine
Var /Global DeleteOldEngineLabel



Expand All @@ -38,6 +40,7 @@ FunctionEnd
!define MUI_PAGE_CUSTOMFUNCTION_SHOW DirectoryPageShow
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!define MUI_PAGE_CUSTOMFUNCTION_SHOW FinishPageShow
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE FinishLeave
!define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_SHOWREADME
Expand All @@ -46,6 +49,16 @@ FunctionEnd
!define MUI_FINISHPAGE_LINK_LOCATION "https://yaklang.com"
!insertmacro MUI_PAGE_FINISH


Function FinishPageShow
${NSD_CreateCheckbox} 120u 130u 9u 9u ""
Pop $DeleteOldEngine
${NSD_CreateLabel} 131u 130u 60% 16u "删除旧引擎"
Pop $DeleteOldEngineLabel
SetCtlColors $DeleteOldEngineLabel "0x000000" "TRANSPARENT"
${NSD_Check} $DeleteOldEngine
FunctionEnd

Function FinishLeave
${NSD_GetState} $mui.FinishPage.Run $0
${If} $0 <> 0
Expand All @@ -55,6 +68,11 @@ Function FinishLeave
${If} $0 <> 0
CreateShortCut "$DESKTOP\$EXE_NAME.lnk" "$INSTDIR\$EXE_NAME.exe"
${EndIf}
${NSD_GetState} $DeleteOldEngine $0
${If} $0 <> 0
; 删除旧引擎代码
Delete /REBOOTOK $INSTDIR\yakit-projects\yak-engine\*yak-*
${EndIf}
Quit
FunctionEnd

Expand Down

0 comments on commit f5fd933

Please sign in to comment.