mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-05 04:53:44 +08:00
fix: Check if the install directory is empty when uninstall
This commit is contained in:
parent
57f5478731
commit
9258a3dcd4
@ -743,6 +743,30 @@ Function un.onInit
|
|||||||
|
|
||||||
!insertmacro MUI_UNGETLANGUAGE
|
!insertmacro MUI_UNGETLANGUAGE
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
Function un.isDirectoryEmpty
|
||||||
|
Exch $0
|
||||||
|
Push $1
|
||||||
|
Push $2
|
||||||
|
StrCpy $2 0
|
||||||
|
FindFirst $1 $2 "$0\*.*"
|
||||||
|
loop:
|
||||||
|
StrCmp $2 "" done
|
||||||
|
StrCmp $2 "." next
|
||||||
|
StrCmp $2 ".." next
|
||||||
|
StrCpy $0 0
|
||||||
|
goto done
|
||||||
|
next:
|
||||||
|
FindNext $1 $2
|
||||||
|
goto loop
|
||||||
|
done:
|
||||||
|
FindClose $1
|
||||||
|
StrCmp $2 "" 0 +2
|
||||||
|
StrCpy $0 1
|
||||||
|
Pop $2
|
||||||
|
Pop $1
|
||||||
|
Exch $0
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
Section Uninstall
|
Section Uninstall
|
||||||
!insertmacro CheckIfAppIsRunning
|
!insertmacro CheckIfAppIsRunning
|
||||||
@ -756,7 +780,7 @@ Section Uninstall
|
|||||||
{{#each resources}}
|
{{#each resources}}
|
||||||
Delete "$INSTDIR\\{{this.[1]}}"
|
Delete "$INSTDIR\\{{this.[1]}}"
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
Delete "$INSTDIR\resources"
|
||||||
; Delete external binaries
|
; Delete external binaries
|
||||||
{{#each binaries}}
|
{{#each binaries}}
|
||||||
Delete "$INSTDIR\\{{this}}"
|
Delete "$INSTDIR\\{{this}}"
|
||||||
@ -765,13 +789,14 @@ Section Uninstall
|
|||||||
; Delete uninstaller
|
; Delete uninstaller
|
||||||
Delete "$INSTDIR\uninstall.exe"
|
Delete "$INSTDIR\uninstall.exe"
|
||||||
|
|
||||||
${If} $DeleteAppDataCheckboxState == 1
|
; Remove InstallDir
|
||||||
|
Push "$INSTDIR"
|
||||||
|
Call un.isDirectoryEmpty
|
||||||
|
Pop $0
|
||||||
|
${If} $0 == 1
|
||||||
RMDir /R /REBOOTOK "$INSTDIR"
|
RMDir /R /REBOOTOK "$INSTDIR"
|
||||||
${Else}
|
${Else}
|
||||||
{{#each resources_ancestors}}
|
MessageBox MB_OK "Install Directory is not Empty, Please remove it manually."
|
||||||
RMDir /REBOOTOK "$INSTDIR\\{{this}}"
|
|
||||||
{{/each}}
|
|
||||||
RMDir "$INSTDIR"
|
|
||||||
${EndIf}
|
${EndIf}
|
||||||
|
|
||||||
; Remove start menu shortcut
|
; Remove start menu shortcut
|
||||||
|
Loading…
x
Reference in New Issue
Block a user