fix(bundler/nsis): fix registering deep-link protocols (#9833)

* fix(bundler/nsis): fix registering deep-link protocols

* Update bundler-nsis-deep-links.md

---------

Co-authored-by: Fabian-Lars <fabianlars@fabianlars.de>
This commit is contained in:
Amr Bashir 2024-05-21 12:01:37 +03:00 committed by GitHub
parent 0c61784efb
commit d0d974fa5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 8 deletions

View File

@ -0,0 +1,5 @@
---
"tauri-bundler": "patch:bug"
---
Fix NSIS installer deep links registration.

View File

@ -570,11 +570,11 @@ Section Install
{{/each}}
; Register deep links
{{#each deep_link_protocol as |protocol| ~}}
WriteRegStr SHCTX "Software\Classes\{{protocol}}" "URL Protocol" ""
WriteRegStr SHCTX "Software\Classes\{{protocol}}" "" "URL:${BUNDLEID} protocol"
WriteRegStr SHCTX "Software\Classes\{{protocol}}\DefaultIcon" "" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\",0"
WriteRegStr SHCTX "Software\Classes\{{protocol}}\shell\open\command" "" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\" $\"%1$\""
{{#each deep_link_protocols as |protocol| ~}}
WriteRegStr SHCTX "Software\Classes\\{{protocol}}" "URL Protocol" ""
WriteRegStr SHCTX "Software\Classes\\{{protocol}}" "" "URL:${BUNDLEID} protocol"
WriteRegStr SHCTX "Software\Classes\\{{protocol}}\DefaultIcon" "" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\",0"
WriteRegStr SHCTX "Software\Classes\\{{protocol}}\shell\open\command" "" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\" $\"%1$\""
{{/each}}
; Create uninstaller
@ -700,10 +700,10 @@ Section Uninstall
{{/each}}
; Delete deep links
{{#each deep_link_protocol as |protocol| ~}}
ReadRegStr $R7 SHCTX "Software\Classes\{{protocol}}\shell\open\command" ""
{{#each deep_link_protocols as |protocol| ~}}
ReadRegStr $R7 SHCTX "Software\Classes\\{{protocol}}\shell\open\command" ""
!if $R7 == "$\"$INSTDIR\${MAINBINARYNAME}.exe$\" $\"%1$\""
DeleteRegKey SHCTX "Software\Classes\{{protocol}}"
DeleteRegKey SHCTX "Software\Classes\\{{protocol}}"
!endif
{{/each}}