vlc | branch: master | Marvin Scholz <[email protected]> | Sun Dec 10 16:43:09 2017 +0100| [2b6c36dde9b62111baa3cd695b85a609b4c9d841] | committer: Marvin Scholz
NSIS: Remove old files before new install Fix #19253 > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=2b6c36dde9b62111baa3cd695b85a609b4c9d841 --- extras/package/win32/NSIS/helpers/utils.nsh | 47 +++++++++++++++++++++++++++++ extras/package/win32/NSIS/vlc.win32.nsi.in | 20 ++++++++++++ 2 files changed, 67 insertions(+) diff --git a/extras/package/win32/NSIS/helpers/utils.nsh b/extras/package/win32/NSIS/helpers/utils.nsh index 899bd8d21d..8b4d5e3ba3 100644 --- a/extras/package/win32/NSIS/helpers/utils.nsh +++ b/extras/package/win32/NSIS/helpers/utils.nsh @@ -214,6 +214,27 @@ Function un.TrimNewlines Exch $R0 FunctionEnd +Function TrimNewlines + Exch $R0 + Push $R1 + Push $R2 + StrCpy $R1 0 + + loop: + IntOp $R1 $R1 - 1 + StrCpy $R2 $R0 1 $R1 + StrCmp $R2 "$\r" loop + StrCmp $R2 "$\n" loop + IntOp $R1 $R1 + 1 + IntCmp $R1 0 no_trim_needed + StrCpy $R0 $R0 $R1 + + no_trim_needed: + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + Function un.RemoveEmptyDirs Pop $9 !define Index 'Line${__LINE__}' @@ -240,6 +261,32 @@ Function un.RemoveEmptyDirs !undef Index FunctionEnd +Function RemoveEmptyDirs + Pop $9 + !define Index 'Line${__LINE__}' + FindFirst $0 $1 "$INSTDIR$9*" + StrCmp $0 "" "${Index}-End" + "${Index}-Loop:" + StrCmp $1 "" "${Index}-End" + StrCmp $1 "." "${Index}-Next" + StrCmp $1 ".." "${Index}-Next" + Push $0 + Push $1 + Push $9 + Push "$9$1\" + Call RemoveEmptyDirs + Pop $9 + Pop $1 + Pop $0 + RMDir "$INSTDIR$9$1" + "${Index}-Next:" + FindNext $0 $1 + Goto "${Index}-Loop" + "${Index}-End:" + FindClose $0 + !undef Index +FunctionEnd + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Check if VLC is running and kill it if necessary ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/extras/package/win32/NSIS/vlc.win32.nsi.in b/extras/package/win32/NSIS/vlc.win32.nsi.in index 2608644950..de27e38f55 100644 --- a/extras/package/win32/NSIS/vlc.win32.nsi.in +++ b/extras/package/win32/NSIS/vlc.win32.nsi.in @@ -238,6 +238,26 @@ ${MementoSection} "$(Name_Section01)" SEC01 DetailPrint "$(Detail_CheckProcesses)" Call CheckRunningProcesses + ; Remove previous version first, if this is update + ${If} $ReinstallType == "1" + FileOpen $UninstallLog "$INSTDIR\uninstall.log" r + UninstallLoop: + ClearErrors + FileRead $UninstallLog $R0 + IfErrors UninstallEnd + Push $R0 + Call TrimNewLines + Pop $R0 + Delete "$INSTDIR\$R0" + Goto UninstallLoop + UninstallEnd: + FileClose $UninstallLog + Delete "$INSTDIR\uninstall.log" + Delete "$INSTDIR\uninstall.exe" + Push "\" + Call RemoveEmptyDirs + ${EndIf} + !insertmacro OpenUninstallLog ; VLC.exe, libvlc.dll _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
