mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2024-11-16 11:42:21 +08:00
fix: Check if the install directory is empty when uninstall
This commit is contained in:
parent
74a3290abc
commit
2df8f1acdb
|
@ -744,6 +744,30 @@ Function un.onInit
|
|||
!insertmacro MUI_UNGETLANGUAGE
|
||||
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
|
||||
!insertmacro CheckIfAppIsRunning
|
||||
!insertmacro CheckAllVergeProcesses
|
||||
|
@ -756,7 +780,7 @@ Section Uninstall
|
|||
{{#each resources}}
|
||||
Delete "$INSTDIR\\{{this.[1]}}"
|
||||
{{/each}}
|
||||
|
||||
Delete "$INSTDIR\resources"
|
||||
; Delete external binaries
|
||||
{{#each binaries}}
|
||||
Delete "$INSTDIR\\{{this}}"
|
||||
|
@ -765,13 +789,14 @@ Section Uninstall
|
|||
; Delete uninstaller
|
||||
Delete "$INSTDIR\uninstall.exe"
|
||||
|
||||
${If} $DeleteAppDataCheckboxState == 1
|
||||
; Remove InstallDir
|
||||
Push "$INSTDIR"
|
||||
Call un.isDirectoryEmpty
|
||||
Pop $0
|
||||
${If} $0 == 1
|
||||
RMDir /R /REBOOTOK "$INSTDIR"
|
||||
${Else}
|
||||
{{#each resources_ancestors}}
|
||||
RMDir /REBOOTOK "$INSTDIR\\{{this}}"
|
||||
{{/each}}
|
||||
RMDir "$INSTDIR"
|
||||
MessageBox MB_OK "Install Directory is not Empty, Please remove it manually."
|
||||
${EndIf}
|
||||
|
||||
; Remove start menu shortcut
|
||||
|
|
Loading…
Reference in New Issue
Block a user