Archive: Ideal way of reading IO ini file


Ideal way of reading IO ini file
I could do this:

!insertmacro INSTALLOPTIONS_READ $VAR "ioFile.ini" "Field 1" "Name"


or

ReadINIStr $VAR $PLUGINSDIR\"ioFile.ini" "Field 1" "Name"


Both works, but what is the ideal way of reading Field 1's Name? I ask 'coz I hear many options in NSIS are deprecated these days. Also what difference it makes?

I use

!insertmacro INSTALLOPTIONS_WRITE "ioFile.ini" "Field 1" "Name" $VAR


to write values though..

You can actually answer this question yourself: Look in NSIS\Include\InstallOptions.nsh and see for yourself what the INSTALLOPTIONS_READ macro does, exactly.

(Moral of today's story: If you are interested in "What's best", don't just accept existing stuff the way it is. Instead, investigate how it works, and gain valuable experience and know-how from it.)


MSG, thanks for your valuable reply. I looked and found that they are identical. So both are just the same (I am too naive to know this beforehand. TBH, I do not know how a macro works. Nor written a macro myself :)).

Since both are identical, what is a more accepted coding practice? I think it is to call the macro (like !insertmacro read) than calling the function itself?


The macros are there just to show that you are reading/writing InstallOptions INI files (and also so you don't need to prefix the INI file path with $PLUGINSDIR\).

You may as well just use them.

Stu