[vlc-commits] nsis: simplify OS detection

Ludovic Fauvet git at videolan.org
Thu Dec 5 13:03:33 CET 2013


vlc/vlc-2.1 | branch: master | Ludovic Fauvet <etix at videolan.org> | Fri Nov 29 16:10:37 2013 +0100| [22dc2227f09e8f4c939013ff726d5d23968acd28] | committer: Ludovic Fauvet

nsis: simplify OS detection

Signed-off-by: Ludovic Fauvet <etix at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=22dc2227f09e8f4c939013ff726d5d23968acd28
---

 extras/package/win32/NSIS/helpers/extensions.nsh |   24 +++++--------------
 extras/package/win32/NSIS/vlc.win32.nsi.in       |   27 +++++++++-------------
 2 files changed, 17 insertions(+), 34 deletions(-)

diff --git a/extras/package/win32/NSIS/helpers/extensions.nsh b/extras/package/win32/NSIS/helpers/extensions.nsh
index e8fb1f4..05a4807 100644
--- a/extras/package/win32/NSIS/helpers/extensions.nsh
+++ b/extras/package/win32/NSIS/helpers/extensions.nsh
@@ -19,15 +19,9 @@ NoBackup:
   WriteRegStr HKCR "VLC$R0\shell\Open\command" "" '"$INSTDIR\vlc.exe" --started-from-file "%1"'
   WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
 
-;;; Vista Only part
-  ; Vista and above detection
-  ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
-  StrCpy $R2 $R1 1
-  StrCmp $R2 '6' ForVista ToEnd
-ForVista:
-  WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations" "$R0" "VLC$R0"
-
-ToEnd:
+  ${If} ${AtLeastWinVista}
+    WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations" "$R0" "VLC$R0"
+  ${EndIf}
 FunctionEnd
 
 ;; Function that registers one skin extension for VLC
@@ -46,15 +40,9 @@ NoBackup:
   WriteRegStr HKCR "VLC$R0\shell\Open\command" "" '"$INSTDIR\vlc.exe" -Iskins --skins2-last "%1"'
   WriteRegStr HKCR "VLC$R0\DefaultIcon" "" '"$INSTDIR\vlc.exe",0'
 
-;;; Vista Only part
-  ; Vista and above detection
-  ReadRegStr $R1 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
-  StrCpy $R2 $R1 1
-  StrCmp $R2 '6' ForVista ToEnd
-ForVista:
-  WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations" "$R0" "VLC$R0"
-
-ToEnd:
+  ${If} ${AtLeastWinVista}
+    WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities\FileAssociations" "$R0" "VLC$R0"
+  ${EndIf}
 FunctionEnd
 
 ;; Function that removes one extension that VLC owns.
diff --git a/extras/package/win32/NSIS/vlc.win32.nsi.in b/extras/package/win32/NSIS/vlc.win32.nsi.in
index 8278413..0a113e7 100644
--- a/extras/package/win32/NSIS/vlc.win32.nsi.in
+++ b/extras/package/win32/NSIS/vlc.win32.nsi.in
@@ -215,23 +215,18 @@ ${MementoSection} $Name_Section01 SEC01
   WriteRegStr HKCR Applications\vlc.exe\shell\Open\command "" '"$INSTDIR\vlc.exe" --started-from-file "%1"'
   !insertmacro MacroAllExtensions WriteRegStrSupportedTypes
 
-; Windows default programs Registration
+  ; Windows default programs Registration
   ; Vista and above detection
-  ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion
-  StrCpy $R1 $R0 1
-  StrCmp $R1 '6' lbl_vista lbl_done
-
-  lbl_vista:
-  WriteRegStr HKLM "Software\RegisteredApplications" "VLC" "Software\Clients\Media\VLC\Capabilities"
-  WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationName" "VLC media player"
-  WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationDescription" "VLC - The video swiss knife"
-  WriteRegStr HKLM "Software\Clients\Media\VLC" "" "VLC media player"
-  WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "HideIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /HideIcons /S"
-  WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ShowIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /ShowIcons /S"
-  WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ReinstallCommand" "$\"$INSTDIR\spad-setup.exe$\" /Reinstall /S"
-  WriteRegDWORD HKLM "Software\Clients\Media\VLC\InstallInfo" "IconsVisible" 0x001
-
-  lbl_done:
+  ${If} ${AtLeastWinVista}
+    WriteRegStr HKLM "Software\RegisteredApplications" "VLC" "Software\Clients\Media\VLC\Capabilities"
+    WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationName" "VLC media player"
+    WriteRegStr HKLM "Software\Clients\Media\VLC\Capabilities" "ApplicationDescription" "VLC - The video swiss knife"
+    WriteRegStr HKLM "Software\Clients\Media\VLC" "" "VLC media player"
+    WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "HideIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /HideIcons /S"
+    WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ShowIconsCommand" "$\"$INSTDIR\spad-setup.exe$\" /ShowIcons /S"
+    WriteRegStr HKLM "Software\Clients\Media\VLC\InstallInfo" "ReinstallCommand" "$\"$INSTDIR\spad-setup.exe$\" /Reinstall /S"
+    WriteRegDWORD HKLM "Software\Clients\Media\VLC\InstallInfo" "IconsVisible" 0x001
+  ${EndIf}
 ${MementoSectionEnd}
 
 ${MementoSection} $Name_Section02a SEC02a



More information about the vlc-commits mailing list