[vlc-commits] nsis: Rework displayed file type

Hugo Beauzée-Luyssen git at videolan.org
Tue Jun 12 16:23:17 CEST 2018


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

nsis: Rework displayed file type

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=565d5c5087c1c4c25c25d0d079b81d3025abf207
---

 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