X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=vlc.win32.nsi.in;h=05a41df0415a9c0e3eed2ae1813dba65ed1af181;hb=9a234d8f17398290ba38476995050a751a9b85ac;hp=033a9c63a5badbc0de8e29f4f5dd71e60a586552;hpb=92e730c19cc89684f15f93a9f98c265806354543;p=vlc diff --git a/vlc.win32.nsi.in b/vlc.win32.nsi.in index 033a9c63a5..05a41df041 100644 --- a/vlc.win32.nsi.in +++ b/vlc.win32.nsi.in @@ -13,6 +13,8 @@ !define PRODUCT_UNINST_ROOT_KEY "HKLM" !define PRODUCT_ID "{ea92ef52-afe4-4212-bacb-dfe9fca94cd6}" +@FILE_LIBVLC_DLL@ + ;;;;;;;;;;;;;;;;;;;;;;;;; ; General configuration ; ;;;;;;;;;;;;;;;;;;;;;;;;; @@ -31,7 +33,8 @@ SetCompressor /SOLID lzma SetOverwrite ifnewer CRCCheck on -InstType "Normal" +InstType "Recommended" +InstType "Minimum" InstType "Full" ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -171,9 +174,9 @@ Function RegisterExtension NoBackup: WriteRegStr HKCR "$R0" "" "VLC$R0" ReadRegStr $0 HKCR "VLC$R0" "" - WriteRegStr HKCR "VLC$R0" "" "VLC media file" + WriteRegStr HKCR "VLC$R0" "" "VLC media file ($R0)" WriteRegStr HKCR "VLC$R0\shell" "" "Play" - WriteRegStr HKCR "VLC$R0\shell\Play\command" "" '"$INSTDIR\vlc.exe" --one-instance-when-started-from-file "%1"' + WriteRegStr HKCR "VLC$R0\shell\Play\command" "" '"$INSTDIR\vlc.exe" --started-from-file "%1"' WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0' FunctionEnd @@ -194,7 +197,7 @@ FunctionEnd !macro RegisterExtensionSection EXT Section /o ${EXT} - SectionIn 2 3 + SectionIn 1 3 Push $R0 StrCpy $R0 ${EXT} Call RegisterExtension @@ -219,10 +222,10 @@ FunctionEnd !macro AddContextMenu EXT WriteRegStr HKCR ${EXT}\shell\PlayWithVLC "" "Play with VLC media player" - WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '$INSTDIR\vlc.exe --one-instance-when-started-from-file --no-playlist-enqueue "%1"' + WriteRegStr HKCR ${EXT}\shell\PlayWithVLC\command "" '$INSTDIR\vlc.exe --started-from-file --no-playlist-enqueue "%1"' WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC "" "Add to VLC media player's Playlist" - WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '$INSTDIR\vlc.exe --one-instance-when-started-from-file --playlist-enqueue "%1"' + WriteRegStr HKCR ${EXT}\shell\AddToPlaylistVLC\command "" '$INSTDIR\vlc.exe --started-from-file --playlist-enqueue "%1"' !macroend !macro DeleteContextMenu EXT @@ -235,7 +238,7 @@ FunctionEnd ;;;;;;;;;;;;;;;;;;;;;;;;;; !macro delprefs - SectionIn 2 3 + SectionIn 1 3 StrCpy $0 0 !define Index 'Line${__LINE__}' "${Index}-Loop:" @@ -254,6 +257,65 @@ FunctionEnd !undef Index !macroend +Var UninstallLog + +!macro OpenUninstallLog + FileOpen $UninstallLog "$INSTDIR\uninstall.log" a + 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,31 +325,44 @@ Section "Media player (required)" SEC01 SetShellVarContext all SetOutPath "$INSTDIR" - File vlc.exe - File vlc.exe.manifest - @FILE_LIBVLC_DLL@ - File *.txt + !insertmacro OpenUninstallLog - File /r plugins - File /r locale - File /r osdmenu - File /r skins - File /r http + !insertmacro InstallFile vlc.exe + !insertmacro InstallFile vlc.exe.manifest + !ifdef LIBVLC_DLL + !insertmacro InstallFile ${LIBVLC_DLL} + !endif + !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" + + !insertmacro CloseUninstallLog ; Add VLC to "recomended programs" for the following extensions WriteRegStr HKCR Applications\vlc.exe "" "" WriteRegStr HKCR Applications\vlc.exe "FriendlyAppName" "VLC media player" WriteRegStr HKCR Applications\vlc.exe\shell\Play "" "Play with VLC" WriteRegStr HKCR Applications\vlc.exe\shell\Play\command "" \ - '$INSTDIR\vlc.exe --one-instance-when-started-from-file "%1"' + '$INSTDIR\vlc.exe --started-from-file "%1"' !insertmacro MacroAllExtensions WriteRegStrSupportedTypes WriteRegStr HKCR "AudioCD\shell\PlayWithVLC" "" "Play with VLC media player" WriteRegStr HKCR "AudioCD\shell\PlayWithVLC\command" "" \ - "$INSTDIR\vlc.exe --one-instance-when-started-from-file cdda:%1" + "$INSTDIR\vlc.exe --started-from-file cdda:%1" WriteRegStr HKCR "DVD\shell\PlayWithVLC" "" "Play with VLC media player" WriteRegStr HKCR "DVD\shell\PlayWithVLC\command" "" \ - "$INSTDIR\vlc.exe --one-instance-when-started-from-file dvd:%1" + "$INSTDIR\vlc.exe --started-from-file dvd:%1" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayDVDMovieOnArrival" "VLCPlayDVDMovieOnArrival" "" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayDVDMovieOnArrival" "Action" "Play DVD movie" @@ -298,19 +373,19 @@ Section "Media player (required)" SEC01 WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers\PlayCDAudioOnArrival" "VLCPlayCDAudioOnArrival" "" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Action" "Play CD audio" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe --one-instance-when-started-from-file",0' + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "DefaultIcon" '"$INSTDIR\vlc.exe --started-from-file",0' WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeProgID" "VLC.CDAudio" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "InvokeVerb" "play" WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\Handlers\VLCPlayCDAudioOnArrival" "Provider" "VideoLAN VLC media player" WriteRegStr HKCR "VLC.DVDMovie" "" "VLC DVD Movie" WriteRegStr HKCR "VLC.DVDMovie\shell" "" "Play" WriteRegStr HKCR "VLC.DVDMovie\shell\Play\command" "" \ - '$INSTDIR\vlc.exe --one-instance-when-started-from-file dvd:%1' + '$INSTDIR\vlc.exe --started-from-file dvd:%1' WriteRegStr HKCR "VLC.DVDMovie\DefaultIcon" "" '"$INSTDIR\vlc.exe",0' WriteRegStr HKCR "VLC.CDAudio" "" "VLC CD Audio" WriteRegStr HKCR "VLC.CDAudio\shell" "" "Play" WriteRegStr HKCR "VLC.CDAudio\shell\Play\command" "" \ - '$INSTDIR\vlc.exe --one-instance-when-started-from-file cdda:%1' + '$INSTDIR\vlc.exe --started-from-file cdda:%1' WriteRegStr HKCR "VLC.CDAudio\DefaultIcon" "" '"$INSTDIR\vlc.exe",0' SectionEnd @@ -319,19 +394,11 @@ Section "Start Menu Shortcut" SEC02a SectionIn 1 2 3 CreateDirectory "$SMPROGRAMS\VideoLAN" CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player.lnk" \ - "$INSTDIR\vlc.exe" "--intf wx --wx-embed" - CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player (alt).lnk" \ - "$INSTDIR\vlc.exe" "--intf wx --no-wx-embed" - CreateShortCut "$SMPROGRAMS\VideoLAN\VLC media player (skins).lnk" \ - "$INSTDIR\vlc.exe" "--intf skins" + "$INSTDIR\vlc.exe" "" 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 @@ -339,12 +406,15 @@ SectionEnd Section "Desktop Shortcut" SEC02b SectionIn 1 2 3 CreateShortCut "$DESKTOP\VLC media player.lnk" \ - "$INSTDIR\vlc.exe" "--intf wx" + "$INSTDIR\vlc.exe" "" SectionEnd Section /o "Mozilla plugin" SEC03 - SectionIn 2 3 - File /r mozilla + SectionIn 1 3 + + !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 @@ -373,6 +443,9 @@ Section /o "Mozilla plugin" SEC03 StrCmp $R2 "" "${Index}-Loop" "" CopyFiles "$INSTDIR\mozilla\*" "$R2" + !ifdef LIBVLC_DLL + CopyFiles ${LIBVLC_DLL} "$R2" + !endif Goto "${Index}-Loop" "${Index}-End:" @@ -380,15 +453,17 @@ Section /o "Mozilla plugin" SEC03 SectionEnd -Section "ActiveX plugin" SEC04 - SectionIn 2 3 +Section /o "ActiveX plugin" SEC04 + SectionIn 1 3 SetOutPath "$INSTDIR" - File activex\axvlc.dll + !insertmacro OpenUninstallLog + !insertmacro InstallFile activex\axvlc.dll + !insertmacro CloseUninstallLog RegDLL "$INSTDIR\axvlc.dll" SectionEnd -Section "Context Menus" SEC05 - SectionIn 2 3 +Section /o "Context Menus" SEC05 + SectionIn 3 !insertmacro MacroAllExtensions AddContextMenu !insertmacro AddContextMenu "Directory" SectionEnd @@ -471,6 +546,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 @@ -499,7 +627,6 @@ Section "Uninstall" SEC91 ReadRegStr $R2 HKLM "SOFTWARE\Mozilla\$R0\Extensions" "Plugins" StrCmp $R2 "" "${Index}-Loop" "" - Delete "$R2\vlcintf.xpt" Delete "$R2\npvlc.dll" Goto "${Index}-Loop" @@ -508,7 +635,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 @@ -534,6 +679,7 @@ Section "Uninstall" SEC91 SectionEnd Section /o "un.Delete preferences and cache" SEC92 + SectionIn 1 3 !insertmacro delprefs SectionEnd