summaryrefslogtreecommitdiffstats
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
commit0f25d9091c7e4347c1d39158b6565c5eb02f4f4c (patch)
tree640df6393b72ad35befd0ba74cd99b769575a607
parentd28e38a3e50ae64e5c65f84a6f8b3c3f51b87b54 (diff)
downloadtxr-0f25d9091c7e4347c1d39158b6565c5eb02f4f4c.tar.gz
txr-0f25d9091c7e4347c1d39158b6565c5eb02f4f4c.tar.bz2
txr-0f25d9091c7e4347c1d39158b6565c5eb02f4f4c.zip
nsis: fixes for file assoc module from NSIS Wiki.
* win/fassoc.nsh: Patch applied.
-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