Archive: WriteIniStr problem


WriteIniStr problem
I'm adding entries to a INI file which works if the INI file doesn't exist. However it won't add entries to an existing INI file. I have created a simple test setup which will add the entries so I know it's not a mistyped command or permissions problem. Any ideas what to do next ?

The command is
WriteINIStr "$WINDIR\ENCORE.INI" "$INSTDIR\" "DATA" "$DATADIR\"

On first install, creates encore.ini with correct values. Install again to another directory and no new section is added.

Thanks

Matt


If your copying the INI file from a CD before you edit it make sure it's not read-only. Just to test add a MessageBox just before you write to that file and then check the properties on it before you write to it.


On first install, creates encore.ini with correct values. Install again to another directory and no new section is added.
1st) Put a MessageBox before the command, like scully13 said, but to know what is being written to the file:
MessageBox MB_OK `"$WINDIR\ENCORE.INI" "$INSTDIR\" "DATA" "$DATADIR\"`
WriteINIStr "$WINDIR\ENCORE.INI" "$INSTDIR\" "DATA" "$DATADIR\"
Return to here and say the results after.

RESOLVED!

I had opened the ini file earlier, 6 pages away, to read info about existing installs. This code was missing a FileClose.

First time round, ini file wasn't there, read failed and so file wasn't already open when trying to write.

Second time, ini file was there so was opened for read and left open when NSIS was trying write.

Thank you for your time and suggestions. I was going round in circles on this one.


...