Skip to content
⌘ NSIS Forum Archive

"ifempty" not working?

3 posts

Joel#

"ifempty" not working?

Write to registry:
Name "test"
OutFile "test.exe"
ShowInstDetails show
Page instfiles
Section
WriteRegStr HKLM "Software\nsis-test" "data" "somedata"
WriteRegStr HKLM "Software\nsis-test" "info" "someinfo"
WriteRegDWORD HKLM "Software\nsis-test" "Value" 10
WriteRegStr HKLM "Software\nsis-test" "key" "somekey"
SectionEnd 
Now deleting one value and later try to remove the hole key (ifempty):
Name "test"
OutFile "test.exe"
ShowInstDetails show
Page instfiles
Section
DeleteRegValue HKLM "Software\nsis-test" "data"
DeleteRegKey /ifempty HKLM "Software\nsis-test"
SectionEnd 
But the installer remove all the "Software\nsis-test" even still some keys...is this normal?
I'm using nsis 2.25
dienjd#
The documentation specifies that /ifempty relates to subkeys. So your example did have some values, but since it didn't have any subkeys, /ifempty did not prevent the key from being removed.