summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-05-25 20:38:43 -0700
committerKaz Kylheku <kaz@kylheku.com>2019-05-25 20:38:43 -0700
commitf35d1018d12253424e8f6e40fe7fb5c5a8cc6cde (patch)
tree640df6393b72ad35befd0ba74cd99b769575a607 /win
parent1112870551a886769e2e4571b0a4145958157972 (diff)
downloadtxr-f35d1018d12253424e8f6e40fe7fb5c5a8cc6cde.tar.gz
txr-f35d1018d12253424e8f6e40fe7fb5c5a8cc6cde.tar.bz2
txr-f35d1018d12253424e8f6e40fe7fb5c5a8cc6cde.zip
nsis: fixes for file assoc module from NSIS Wiki.
* win/fassoc.nsh: Patch applied.
Diffstat (limited to 'win')
-rw-r--r--win/fassoc.nsh13
1 files changed, 11 insertions, 2 deletions
diff --git a/win/fassoc.nsh b/win/fassoc.nsh
index 36cdf913..e731cead 100644
--- a/win/fassoc.nsh
+++ b/win/fassoc.nsh
@@ -67,6 +67,8 @@
Push $1
ReadRegStr $1 HKCR $R1 "" ; read current file association
+ IfErrors NoBackup CheckBackup
+CheckBackup:
StrCmp "$1" "" NoBackup ; is it empty
StrCmp "$1" "$R0" NoBackup ; is it our own
WriteRegStr HKCR $R1 "backup_val" "$1" ; backup current value
@@ -74,6 +76,7 @@ NoBackup:
WriteRegStr HKCR $R1 "" "$R0" ; set our file association
ReadRegStr $0 HKCR $R0 ""
+ IfErrors 0 #basically ignore any error from non-existing reg key
StrCmp $0 "" 0 Skip
WriteRegStr HKCR "$R0" "" "$R0"
WriteRegStr HKCR "$R0\shell" "" "open"
@@ -115,9 +118,15 @@ Skip:
Push $1
ReadRegStr $1 HKCR $R0 ""
- StrCmp $1 $R1 0 NoOwn ; only do this if we own it
+ IfErrors NoOwn CheckSame
+CheckSame:
+ StrCmp $1 $R1 ReadBackup NoOwn ; only do this if we own it
+ReadBackup:
ReadRegStr $1 HKCR $R0 "backup_val"
- StrCmp $1 "" 0 Restore ; if backup="" then delete the whole key
+ IfErrors DeleteWhole CheckRestore
+CheckRestore:
+ StrCmp $1 "" DeleteWhole Restore ; if backup="" then delete the whole key
+DeleteWhole:
DeleteRegKey HKCR $R0
Goto NoOwn