summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
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