Browse Source

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>
Amr Bashir 1 year ago
parent
commit
d0d974fa5e

+ 5 - 0
.changes/bundler-nsis-deep-links.md

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

+ 8 - 8
tooling/bundler/src/bundle/windows/templates/installer.nsi

@@ -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}}