Skip to content
⌘ NSIS Forum Archive

WriteINIStr removes INI entries

4 posts

bmatzelle1#

WriteINIStr removes INI entries

When I perform this call with an empty entry it removes the INI entry from the file.

my.ini:
[section]
my_item=""
another_item="abc"

WriteINIStr $INSTDIR\my.ini section my_item ""

Now my.ini looks like this:

[section]
another_item="abc"

This is a very unwanted behavior. Is this a bug?

Brent
Guest#
This might be a bug, but it is easily overcome: replace the empty string "" by " " (a space). Now the entry doesn't get deleted!

-Hendri.
rainwater#
I believe this is happening because of the way the windows API call to add the ini entry works. I don't think this is a problem of NSIS's doing.
Joost Verburg#
Originally posted by rainwater
I believe this is happening because of the way the windows API call to add the ini entry works. I don't think this is a problem of NSIS's doing.
[edit]
That's right.

The Win32 API deletes the entry when a null string is given as value.