]> sigrok.org Git - pulseview.git/commitdiff
Fix #964 by adding an option to register the .sr extension with PV
authorSoeren Apel <redacted>
Sat, 3 Jun 2017 20:47:10 +0000 (22:47 +0200)
committerUwe Hermann <redacted>
Sat, 3 Jun 2017 20:54:32 +0000 (22:54 +0200)
contrib/pulseview_cross.nsi.in

index 0e6921970005e67cedd9d73036c0a4e243ee7da4..14b2807dc936eb54319ad41a656f2c5dd4095185 100644 (file)
@@ -30,6 +30,9 @@
 # Include the "Modern UI" header, which gives us the usual Windows look-n-feel.
 !include "MUI2.nsh"
 
+# Include the file association header so that we can register file extensions.
+!include "FileAssociation.nsh"
+
 
 # --- Global stuff ------------------------------------------------------------
 
@@ -74,6 +77,13 @@ RequestExecutionLevel admin
 !define CROSS "@CMAKE_INSTALL_PREFIX@"
 
 
+# --- Functions ---------------------------------------------------------------
+
+Function register_sr_files
+${registerExtension} "$INSTDIR\pulseview.exe" ".sr" "sigrok session file"
+FunctionEnd
+
+
 # --- MUI pages ---------------------------------------------------------------
 
 # Show a nice "Welcome to the ... Setup Wizard" page.
@@ -91,6 +101,14 @@ RequestExecutionLevel admin
 # Perform the actual installation, i.e. install the files.
 !insertmacro MUI_PAGE_INSTFILES
 
+# Insert the "Show Readme" button in the finish dialog. We repurpose it for
+# registering the .sr file extension. This way, we don't need to add in-depth
+# modifications to the finish page.
+!define MUI_FINISHPAGE_SHOWREADME ""
+!define MUI_FINISHPAGE_SHOWREADME_CHECKED
+!define MUI_FINISHPAGE_SHOWREADME_TEXT "Register .sr files with PulseView"
+!define MUI_FINISHPAGE_SHOWREADME_FUNCTION register_sr_files
+
 # Show a final "We're done, click Finish to close this wizard" message.
 !insertmacro MUI_PAGE_FINISH
 
@@ -241,6 +259,9 @@ Section "Uninstall"
        # Delete the registry key(s).
        DeleteRegKey HKLM "${REGSTR}"
 
+       # Unregister any previously registered file extension(s).
+       ${unregisterExtension} ".sr" "sigrok session file"
+
 SectionEnd