[vlc-commits] nsis: Rework displayed file type

Hugo Beauzée-Luyssen git at videolan.org
Thu Jun 14 13:41:40 CEST 2018


vlc/vlc-3.0 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Tue Jun 12 14:21:10 2018 +0200| [1f9d47a63ea9a958c14db2f37766fc1c4ef5cf31] | committer: Hugo Beauzée-Luyssen

nsis: Rework displayed file type

(cherry picked from commit 565d5c5087c1c4c25c25d0d079b81d3025abf207)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=1f9d47a63ea9a958c14db2f37766fc1c4ef5cf31
---

 extras/package/win32/NSIS/helpers/extensions.nsh | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/extras/package/win32/NSIS/helpers/extensions.nsh b/extras/package/win32/NSIS/helpers/extensions.nsh
index 38861f8dff..c2a521e41b 100644
--- a/extras/package/win32/NSIS/helpers/extensions.nsh
+++ b/extras/package/win32/NSIS/helpers/extensions.nsh
@@ -1,7 +1,13 @@
+!include "StrFunc.nsh"
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ; 1. File type associations ;
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+;; "Initialize" string functions
+${StrRep}
+${StrCase}
+
 ;; Function that associates one extension with VLC
 Function AssociateExtension
   ; back up old value for extension $R0 (eg. ".opt")
@@ -15,7 +21,13 @@ FunctionEnd
 
 ;; Function that registers one extension for VLC
 Function RegisterExtension
-  WriteRegStr HKCR "VLC$R0" "" "VLC media file ($R0)"
+  ; R0 contains the extension, R1 contains the type (Audio/Video)
+  ; Remove the leading dot from the filetype string
+  ${StrRep} $R2 $R0 "." ""
+  ; And capitalize the extension
+  ${StrCase} $R2 $R2 "U"
+  ; for instance: MKV Video File (VLC)
+  WriteRegStr HKCR "VLC$R0" "" "$R2 $R1 File (VLC)"
   WriteRegStr HKCR "VLC$R0\shell" "" "Open"
   WriteRegStr HKCR "VLC$R0\shell\Open" "" "$(ShellAssociation_Play)"
   WriteRegStr HKCR "VLC$R0\shell\Open" "MultiSelectModel" "Player"
@@ -92,7 +104,10 @@ FunctionEnd
 !macro RegisterExtensionMacro TYPE EXT
   Push $R0
   StrCpy $R0 ${EXT}
+  Push $R1
+  StrCpy $R1 ${TYPE}
   Call RegisterExtension
+  Pop $R1
   Pop $R0
 !macroend
 



More information about the vlc-commits mailing list