Old 28th July 2012, 11:16   #1
nawfal
Junior Member
 
Join Date: Jul 2012
Posts: 22
Ideal way of reading IO ini file

I could do this:

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


or

code:
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

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


to write values though..
nawfal is offline   Reply With Quote
Old 28th July 2012, 11:24   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
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 is offline   Reply With Quote
Old 28th July 2012, 12:02   #3
nawfal
Junior Member
 
Join Date: Jul 2012
Posts: 22
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?
nawfal is offline   Reply With Quote
Old 28th July 2012, 12:08   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
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
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
deprecated, installoptions, macro, read, write

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump