!define PRODUCT_UNINST_ROOT_KEY "HKLM"\r
!define PRODUCT_ID "{ea92ef52-afe4-4212-bacb-dfe9fca94cd6}"\r
\r
+@FILE_LIBVLC_DLL@\r
+\r
;;;;;;;;;;;;;;;;;;;;;;;;;\r
; General configuration ;\r
;;;;;;;;;;;;;;;;;;;;;;;;;\r
SetOverwrite ifnewer\r
CRCCheck on\r
\r
-InstType "Normal"\r
+InstType "Recommended"\r
+InstType "Minimum"\r
InstType "Full"\r
\r
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\r
\r
!macro RegisterExtensionSection EXT\r
Section /o ${EXT}\r
- SectionIn 2 3\r
+ SectionIn 1 3\r
Push $R0\r
StrCpy $R0 ${EXT}\r
Call RegisterExtension\r
;;;;;;;;;;;;;;;;;;;;;;;;;;\r
\r
!macro delprefs\r
- SectionIn 2 3\r
+ SectionIn 1 3\r
StrCpy $0 0\r
!define Index 'Line${__LINE__}'\r
"${Index}-Loop:"\r
!undef Index\r
!macroend\r
\r
+Var UninstallLog\r
+\r
+!macro OpenUninstallLog\r
+ FileOpen $UninstallLog "$INSTDIR\uninstall.log" a\r
+ FileSeek $UninstallLog 0 END\r
+!macroend\r
+\r
+!macro CloseUninstallLog\r
+ FileClose $UninstallLog\r
+ SetFileAttributes "$INSTDIR\uninstall.log" HIDDEN\r
+!macroend\r
+\r
+!macro InstallFile FILEREGEX\r
+ File "${FILEREGEX}"\r
+ !define Index 'Line${__LINE__}'\r
+ FindFirst $0 $1 "$INSTDIR\${FILEREGEX}"\r
+ StrCmp $0 "" "${Index}-End"\r
+ "${Index}-Loop:"\r
+ StrCmp $1 "" "${Index}-End"\r
+ FileWrite $UninstallLog "$1$\r$\n"\r
+ FindNext $0 $1\r
+ Goto "${Index}-Loop"\r
+ "${Index}-End:"\r
+ !undef Index\r
+!macroend\r
+\r
+!macro InstallFolder FOLDER\r
+ File /r "${FOLDER}"\r
+ Push "${FOLDER}"\r
+ Call InstallFolderInternal\r
+!macroend\r
+\r
+Function InstallFolderInternal\r
+ Pop $9\r
+ !define Index 'Line${__LINE__}'\r
+ FindFirst $0 $1 "$INSTDIR\$9\*"\r
+ StrCmp $0 "" "${Index}-End"\r
+ "${Index}-Loop:"\r
+ StrCmp $1 "" "${Index}-End"\r
+ StrCmp $1 "." "${Index}-Next"\r
+ StrCmp $1 ".." "${Index}-Next"\r
+ IfFileExists "$9\$1\*" 0 "${Index}-Write"\r
+ Push $0\r
+ Push $9\r
+ Push "$9\$1"\r
+ Call InstallFolderInternal\r
+ Pop $9\r
+ Pop $0\r
+ Goto "${Index}-Next"\r
+ "${Index}-Write:"\r
+ FileWrite $UninstallLog "$9\$1$\r$\n"\r
+ "${Index}-Next:"\r
+ FindNext $0 $1\r
+ Goto "${Index}-Loop"\r
+ "${Index}-End:"\r
+ !undef Index\r
+FunctionEnd\r
+\r
+\r
;;;;;;;;;;;;;;;;;;;;;;\r
; Installer sections ;\r
;;;;;;;;;;;;;;;;;;;;;;\r
SetShellVarContext all\r
SetOutPath "$INSTDIR"\r
\r
- File vlc.exe\r
- File vlc.exe.manifest\r
- @FILE_LIBVLC_DLL@\r
- File *.txt\r
+ !insertmacro OpenUninstallLog\r
\r
- File /r plugins\r
- File /r locale\r
- File /r osdmenu\r
- File /r skins\r
- File /r http\r
+ !insertmacro InstallFile vlc.exe\r
+ !insertmacro InstallFile vlc.exe.manifest\r
+ !ifdef LIBVLC_DLL\r
+ !insertmacro InstallFile ${LIBVLC_DLL}\r
+ !endif\r
+ !insertmacro InstallFile *.txt\r
+\r
+ !insertmacro InstallFolder plugins\r
+ !insertmacro InstallFolder locale\r
+ !insertmacro InstallFolder osdmenu\r
+ !insertmacro InstallFolder skins\r
+ !insertmacro InstallFolder http\r
+\r
+ WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" \\r
+ "${PRODUCT_WEB_SITE}"\r
+ FileWrite $UninstallLog "${PRODUCT_NAME}.url$\r$\n"\r
+ WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \\r
+ "${PRODUCT_WEB_SITE}/doc/"\r
+ FileWrite $UninstallLog "Documentation.url$\r$\n"\r
+\r
+ !insertmacro CloseUninstallLog\r
\r
; Add VLC to "recomended programs" for the following extensions\r
WriteRegStr HKCR Applications\vlc.exe "" ""\r
"$INSTDIR\vlc.exe" "--intf skins"\r
CreateShortCut "$SMPROGRAMS\VideoLAN\Reset VLC defaults and quit.lnk" \\r
"$INSTDIR\vlc.exe" "--reset-config --reset-plugins-cache --save-config vlc:quit "\r
- WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" \\r
- "${PRODUCT_WEB_SITE}"\r
CreateShortCut "$SMPROGRAMS\VideoLAN\${PRODUCT_NAME} Website.lnk" \\r
"$INSTDIR\${PRODUCT_NAME}.url"\r
- WriteIniStr "$INSTDIR\Documentation.url" "InternetShortcut" "URL" \\r
- "${PRODUCT_WEB_SITE}/doc/"\r
CreateShortCut "$SMPROGRAMS\VideoLAN\Documentation.lnk" \\r
"$INSTDIR\Documentation.url"\r
SectionEnd\r
Section "Desktop Shortcut" SEC02b\r
SectionIn 1 2 3\r
CreateShortCut "$DESKTOP\VLC media player.lnk" \\r
- "$INSTDIR\vlc.exe" "--intf wx"\r
+ "$INSTDIR\vlc.exe" ""\r
SectionEnd\r
\r
Section /o "Mozilla plugin" SEC03\r
- SectionIn 2 3\r
- File /r mozilla\r
+ SectionIn 1 3\r
+\r
+ !insertmacro OpenUninstallLog\r
+ !insertmacro InstallFolder mozilla\r
+ !insertmacro CloseUninstallLog\r
\r
; doesn't work. bug in mozilla/mozilla firefox or moz documentation (xpt file isn't loaded)\r
; see mozilla bugs 184506 and 159445\r
StrCmp $R2 "" "${Index}-Loop" ""\r
\r
CopyFiles "$INSTDIR\mozilla\*" "$R2"\r
+ !ifdef LIBVLC_DLL\r
+ CopyFiles ${LIBVLC_DLL} "$R2"\r
+ !endif\r
Goto "${Index}-Loop"\r
\r
"${Index}-End:"\r
\r
SectionEnd\r
\r
-Section "ActiveX plugin" SEC04\r
- SectionIn 2 3\r
+Section /o "ActiveX plugin" SEC04\r
+ SectionIn 1 3\r
SetOutPath "$INSTDIR"\r
- File activex\axvlc.dll\r
+ !insertmacro OpenUninstallLog\r
+ !insertmacro InstallFile activex\axvlc.dll\r
+ !insertmacro CloseUninstallLog\r
RegDLL "$INSTDIR\axvlc.dll"\r
SectionEnd\r
\r
-Section "Context Menus" SEC05\r
- SectionIn 2 3\r
+Section /o "Context Menus" SEC05\r
+ SectionIn 3\r
!insertmacro MacroAllExtensions AddContextMenu\r
!insertmacro AddContextMenu "Directory"\r
SectionEnd\r
; Uninstaller sections ;\r
;;;;;;;;;;;;;;;;;;;;;;;;\r
\r
+; TrimNewlines (copied from NSIS documentation)\r
+; input, top of stack (e.g. whatever$\r$\n)\r
+; output, top of stack (replaces, with e.g. whatever)\r
+; modifies no other variables.\r
+\r
+Function un.TrimNewlines\r
+ Exch $R0\r
+ Push $R1\r
+ Push $R2\r
+ StrCpy $R1 0\r
+ \r
+ loop:\r
+ IntOp $R1 $R1 - 1\r
+ StrCpy $R2 $R0 1 $R1\r
+ StrCmp $R2 "$\r" loop\r
+ StrCmp $R2 "$\n" loop\r
+ IntOp $R1 $R1 + 1\r
+ IntCmp $R1 0 no_trim_needed\r
+ StrCpy $R0 $R0 $R1\r
+ \r
+ no_trim_needed:\r
+ Pop $R2\r
+ Pop $R1\r
+ Exch $R0\r
+FunctionEnd\r
+\r
+Function un.RemoveEmptyDirs\r
+ Pop $9\r
+ !define Index 'Line${__LINE__}'\r
+ FindFirst $0 $1 "$INSTDIR$9*"\r
+ StrCmp $0 "" "${Index}-End"\r
+ "${Index}-Loop:"\r
+ StrCmp $1 "" "${Index}-End"\r
+ StrCmp $1 "." "${Index}-Next"\r
+ StrCmp $1 ".." "${Index}-Next"\r
+ Push $0\r
+ Push $1\r
+ Push $9\r
+ Push "$9$1\"\r
+ Call un.RemoveEmptyDirs\r
+ Pop $9\r
+ Pop $1\r
+ Pop $0\r
+ "${Index}-Remove:"\r
+ RMDir "$INSTDIR$9$1"\r
+ "${Index}-Next:"\r
+ FindNext $0 $1\r
+ Goto "${Index}-Loop"\r
+ "${Index}-End:"\r
+ FindClose $0\r
+ !undef Index\r
+FunctionEnd\r
+\r
Section "Uninstall" SEC91\r
SectionIn 1 2 3 RO\r
SetShellVarContext all\r
\r
RMDir "$SMPROGRAMS\VideoLAN"\r
RMDir /r $SMPROGRAMS\VideoLAN\r
- RMDir /r $INSTDIR\r
+\r
+ FileOpen $UninstallLog "$INSTDIR\uninstall.log" r\r
+ UninstallLoop:\r
+ ClearErrors\r
+ FileRead $UninstallLog $R0\r
+ IfErrors UninstallEnd\r
+ Push $R0\r
+ Call un.TrimNewLines\r
+ Pop $R0\r
+ Delete "$INSTDIR\$R0"\r
+ Goto UninstallLoop\r
+ UninstallEnd:\r
+ FileClose $UninstallLog\r
+ Delete "$INSTDIR\uninstall.log"\r
+ Delete "$INSTDIR\uninstall.exe"\r
+ Push "\"\r
+ Call un.RemoveEmptyDirs\r
+ RMDir "$INSTDIR"\r
+\r
DeleteRegKey HKLM Software\VideoLAN\r
\r
DeleteRegKey HKCR Applications\vlc.exe\r
SectionEnd\r
\r
Section /o "un.Delete preferences and cache" SEC92\r
+ SectionIn 1 3\r
!insertmacro delprefs\r
SectionEnd\r
\r