mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[Installer] Uninstaller deletes only the installed payload, never the whole tree (#7472)
Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
07eb9f0103
commit
f83a61979f
1 changed files with 35 additions and 13 deletions
|
|
@ -304,10 +304,11 @@ SetShellVarContext all
|
||||||
; _?=$INSTDIR keeps the old uninstaller running in place. An NSIS uninstaller
|
; _?=$INSTDIR keeps the old uninstaller running in place. An NSIS uninstaller
|
||||||
; normally copies itself to %TEMP% and runs from there so that it can delete its
|
; normally copies itself to %TEMP% and runs from there so that it can delete its
|
||||||
; own directory, and the process we started exits at once. ExecWait then returns
|
; own directory, and the process we started exits at once. ExecWait then returns
|
||||||
; before the uninstall has run, and the temp copy's "RMDir /r $INSTDIR" executes
|
; before the uninstall has run, and the temp copy keeps deleting files - from
|
||||||
; while the section below is still writing the new payload. _?= disables the copy
|
; 3.1.0 and 3.1.1 on disk a blanket "RMDir /r $INSTDIR" - while the section
|
||||||
; and makes ExecWait block until the uninstall finishes. It must be the last
|
; below is still writing the new payload. _?= disables the copy and makes
|
||||||
; argument and must not be quoted, even when the path contains spaces.
|
; ExecWait block until the uninstall finishes. It must be the last argument
|
||||||
|
; and must not be quoted, even when the path contains spaces.
|
||||||
;
|
;
|
||||||
; --- 32-bit uninstall ---
|
; --- 32-bit uninstall ---
|
||||||
SetRegView 32
|
SetRegView 32
|
||||||
|
|
@ -1107,9 +1108,14 @@ ${AndIf} ${FileExists} "$INSTDIR\portable.dat"
|
||||||
; upgrade portable mode
|
; upgrade portable mode
|
||||||
!insertmacro CockLog "section: portable upgrade purge"
|
!insertmacro CockLog "section: portable upgrade purge"
|
||||||
!insertmacro CockLogListing "before-portable-purge" "*.dll"
|
!insertmacro CockLogListing "before-portable-purge" "*.dll"
|
||||||
|
; plugins and translations are payload and are rewritten by the payload
|
||||||
|
; below, so removing them here is safe. sounds and themes are payload
|
||||||
|
; too - the default packs are rewritten below as well - but a portable
|
||||||
|
; user's custom sounds and themes live in exactly those folders, so a
|
||||||
|
; recursive purge here would delete user content along with the defaults.
|
||||||
|
; Stale default files from an older release are overwritten or replaced
|
||||||
|
; by the payload, never by a purge.
|
||||||
RMDir /r "$INSTDIR\plugins"
|
RMDir /r "$INSTDIR\plugins"
|
||||||
RMDir /r "$INSTDIR\sounds"
|
|
||||||
RMDir /r "$INSTDIR\themes"
|
|
||||||
RMDir /r "$INSTDIR\translations"
|
RMDir /r "$INSTDIR\translations"
|
||||||
Delete "$INSTDIR\uninstall.exe"
|
Delete "$INSTDIR\uninstall.exe"
|
||||||
Delete "$INSTDIR\cockatrice.exe"
|
Delete "$INSTDIR\cockatrice.exe"
|
||||||
|
|
@ -1263,16 +1269,32 @@ Section "un.Application" UnSecApplication
|
||||||
SetShellVarContext all
|
SetShellVarContext all
|
||||||
StrCpy $R1 0
|
StrCpy $R1 0
|
||||||
|
|
||||||
; Record whether this was a portable install before the directory (and the
|
; Record whether this was a portable install before portable.dat is
|
||||||
; portable.dat marker inside it) is removed below.
|
; removed below.
|
||||||
IfFileExists "$INSTDIR\portable.dat" 0 +2
|
IfFileExists "$INSTDIR\portable.dat" 0 +2
|
||||||
StrCpy $R1 1
|
StrCpy $R1 1
|
||||||
|
|
||||||
; Remove the entire application directory so any file that is not part of
|
; Remove only what the installer wrote. The two lists below are generated
|
||||||
; the installed payload (e.g. build-tree artifacts such as *.dir folders,
|
; by CPack from the staged install tree: one Delete per installed file and
|
||||||
; *_autogen and *.tlog files from a build) cannot survive between an
|
; one non-recursive RMDir per installed directory, children first.
|
||||||
; uninstall and a fresh reinstall.
|
; Anything the user put in $INSTDIR - decks, pictures, portable data
|
||||||
RMDir /r "$INSTDIR"
|
; folders - is not on those lists and survives, and $INSTDIR itself is
|
||||||
|
; only removed when nothing else is left in it. An earlier version of this
|
||||||
|
; section ran a blanket "RMDir /r $INSTDIR" to keep build-tree artifacts
|
||||||
|
; out of a fresh reinstall; that also deleted user decks whenever a user
|
||||||
|
; had pointed their data folders into the install directory, so payload
|
||||||
|
; purity may never be bought at that price again.
|
||||||
|
@CPACK_NSIS_DELETE_FILES@
|
||||||
|
@CPACK_NSIS_DELETE_DIRECTORIES@
|
||||||
|
|
||||||
|
; Written by the installer itself, so absent from the staged payload
|
||||||
|
; above; qdebug.txt is app-generated log output next to the executables.
|
||||||
|
Delete "$INSTDIR\uninstall.exe"
|
||||||
|
Delete "$INSTDIR\portable.dat"
|
||||||
|
Delete "$INSTDIR\qdebug.txt"
|
||||||
|
|
||||||
|
; Succeeds only when no foreign files remain.
|
||||||
|
RMDir "$INSTDIR"
|
||||||
|
|
||||||
RMDir /r "$SMPROGRAMS\Cockatrice"
|
RMDir /r "$SMPROGRAMS\Cockatrice"
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue