Commit 0f2c84a1 authored by Antoine Cellerier's avatar Antoine Cellerier

Copy vlc.win32.nsi.in from trunk (== backport recent commits)

parent a2746026
......@@ -254,6 +254,65 @@ FunctionEnd
!undef Index
!macroend
Var UninstallLog
!macro OpenUninstallLog
FileOpen $UninstallLog "$INSTDIR\uninstall.log" w
FileSeek $UninstallLog 0 END
!macroend
!macro CloseUninstallLog
FileClose $UninstallLog
SetFileAttributes "$INSTDIR\uninstall.log" HIDDEN
!macroend
!macro InstallFile FILEREGEX
File "${FILEREGEX}"
!define Index 'Line${__LINE__}'
FindFirst $0 $1 "$INSTDIR\${FILEREGEX}"
StrCmp $0 "" "${Index}-End"
"${Index}-Loop:"
StrCmp $1 "" "${Index}-End"
FileWrite $UninstallLog "$1$\r$\n"
FindNext $0 $1
Goto "${Index}-Loop"
"${Index}-End:"
!undef Index
!macroend
!macro InstallFolder FOLDER
File /r "${FOLDER}"
Push "${FOLDER}"
Call InstallFolderInternal
!macroend
Function InstallFolderInternal
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"
IfFileExists "$9\$1\*" 0 "${Index}-Write"
Push $0
Push $9
Push "$9\$1"
Call InstallFolderInternal
Pop $9
Pop $0
Goto "${Index}-Next"
"${Index}-Write:"
FileWrite $UninstallLog "$9\$1$\r$\n"
"${Index}-Next:"
FindNext $0 $1
Goto "${Index}-Loop"
"${Index}-End:"
!undef Index
FunctionEnd
;;;;;;;;;;;;;;;;;;;;;;
; Installer sections ;
;;;;;;;;;;;;;;;;;;;;;;
......@@ -263,16 +322,27 @@ Section "Media player (required)" SEC01
SetShellVarContext all
SetOutPath "$INSTDIR"
File vlc.exe
File vlc.exe.manifest
!insertmacro OpenUninstallLog
!insertmacro InstallFile vlc.exe
!insertmacro InstallFile vlc.exe.manifest
@FILE_LIBVLC_DLL@
File *.txt
!insertmacro InstallFile *.txt
!insertmacro InstallFolder plugins
!insertmacro InstallFolder locale
!insertmacro InstallFolder osdmenu
!insertmacro InstallFolder skins
!insertmacro InstallFolder http
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" \
"${PRODUCT_WEB_SITE}"
FileWrite $UninstallLog "${PRODUCT_NAME}.url$\r$\n"
WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \
"${PRODUCT_WEB_SITE}/doc/"
FileWrite $UninstallLog "Documentation.url$\r$\n"
File /r plugins
File /r locale
File /r osdmenu
File /r skins
File /r http
!insertmacro CloseUninstallLog
; Add VLC to "recomended programs" for the following extensions
WriteRegStr HKCR Applications\vlc.exe "" ""
......@@ -326,12 +396,8 @@ Section "Start Menu Shortcut" SEC02a
"$INSTDIR\vlc.exe" "--intf skins"
CreateShortCut "$SMPROGRAMS\VideoLAN\Reset VLC defaults and quit.lnk" \
"$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache --save-config vlc:quit "
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" \
"${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_NAME} Website.lnk" \
"$INSTDIR\${PRODUCT_NAME}.url"
WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \
"${PRODUCT_WEB_SITE}/doc/"
CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \
"$INSTDIR\Documentation.url"
SectionEnd
......@@ -344,7 +410,10 @@ SectionEnd
Section /o "Mozilla plugin" SEC03
SectionIn 2 3
File /r mozilla
!insertmacro OpenUninstallLog
!insertmacro InstallFolder mozilla
!insertmacro CloseUninstallLog
; doesn't work. bug in mozilla/mozilla firefox or moz documentation (xpt file isn't loaded)
; see mozilla bugs 184506 and 159445
......@@ -383,7 +452,9 @@ SectionEnd
Section "ActiveX plugin" SEC04
SectionIn 2 3
SetOutPath "$INSTDIR"
File activex\axvlc.dll
!insertmacro OpenUninstallLog
!insertmacro InstallFile activex\axvlc.dll
!insertmacro CloseUninstallLog
RegDLL "$INSTDIR\axvlc.dll"
SectionEnd
......@@ -471,6 +542,59 @@ SectionEnd
; Uninstaller sections ;
;;;;;;;;;;;;;;;;;;;;;;;;
; TrimNewlines (copied from NSIS documentation)
; input, top of stack (e.g. whatever$\r$\n)
; output, top of stack (replaces, with e.g. whatever)
; modifies no other variables.
Function un.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__}'
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 un.RemoveEmptyDirs
Pop $9
Pop $1
Pop $0
"${Index}-Remove:"
RMDir "$INSTDIR$9$1"
"${Index}-Next:"
FindNext $0 $1
Goto "${Index}-Loop"
"${Index}-End:"
FindClose $0
!undef Index
FunctionEnd
Section "Uninstall" SEC91
SectionIn 1 2 3 RO
SetShellVarContext all
......@@ -508,7 +632,25 @@ Section "Uninstall" SEC91
RMDir "$SMPROGRAMS\VideoLAN"
RMDir /r $SMPROGRAMS\VideoLAN
RMDir /r $INSTDIR
FileOpen $UninstallLog "$INSTDIR\uninstall.log" r
UninstallLoop:
ClearErrors
FileRead $UninstallLog $R0
IfErrors UninstallEnd
Push $R0
Call un.TrimNewLines
Pop $R0
Delete "$INSTDIR\$R0"
Goto UninstallLoop
UninstallEnd:
FileClose $UninstallLog
Delete "$INSTDIR\uninstall.log"
Delete "$INSTDIR\uninstall.exe"
Push "\"
Call un.RemoveEmptyDirs
RMDir "$INSTDIR"
DeleteRegKey HKLM Software\VideoLAN
DeleteRegKey HKCR Applications\vlc.exe
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment