Old 11th October 2004, 18:48   #1
Jnuw
Senior Member
 
Join Date: Sep 2004
Location: Wisconsin, US
Posts: 258
Does WriteINIStr command work on Win98???

I was using the WriteINIStr command to add some text to an ini file on my Win2k machine. It was working great. However, when I tested my installer on a Win98 PC, the WriteINIStr command did absolutely nothing. In fact, it seems to prevent the next 1 or 2 commands from working. Here is the code:

WriteINIStr "$INSTDIR\ULogs\ULog.ini" "Info" "bla bla" "1"
Delete "$INSTDIR\ULogs\$ULogLM"
Rename "$INSTDIR\ULogs\ULog.ini" "$ULogLM"

The Rename command would rename the ini into the ULogLM string, but would leave the Ulog.ini file, as if it was locked by the failing WriteINIStr command. Any ideas?

Thanks much all!
Jnuw is offline   Reply With Quote
Old 11th October 2004, 18:54   #2
scully13
Senior Member
 
Join Date: Apr 2004
Posts: 130
If you are copying the ULog.ini file from a CD make sure you remove it's read-only attribute before you use WriteINIStr. Win98 makes files read-only when they are copied from a CD. If you are not copying the file from a CD then ignore me.
scully13 is offline   Reply With Quote
Old 11th October 2004, 19:08   #3
Jnuw
Senior Member
 
Join Date: Sep 2004
Location: Wisconsin, US
Posts: 258
Not copying from a CD, and double checked the files, they are not read only, but thank you very much for the advice. When I comment out the WriteINIStr line, everything works fine, so I think it has something to do with the WriteINIStr command and Win98.
Jnuw is offline   Reply With Quote
Old 11th October 2004, 19:11   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Maybe try FlushINI first.

-Stu
Afrow UK is offline   Reply With Quote
Old 11th October 2004, 19:38   #5
Jnuw
Senior Member
 
Join Date: Sep 2004
Location: Wisconsin, US
Posts: 258
Thanks Afrow UK, should I put the FlushINI command right before, or right after the WriteINIStr command? Thanks.
Jnuw is offline   Reply With Quote
Old 11th October 2004, 20:10   #6
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
Right after WriteINIStr.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 11th October 2004, 20:58   #7
Jnuw
Senior Member
 
Join Date: Sep 2004
Location: Wisconsin, US
Posts: 258
Nope, no luck with the FlushINI as far as actually writing to the ini, however the next commands (Delete and Rename) do work now.
Jnuw is offline   Reply With Quote
Old 11th October 2004, 21:39   #8
deguix
Major Dude
 
deguix's Avatar
 
Join Date: Dec 2002
Location: Everett - MA, USA
Posts: 1,354
Send a message via ICQ to deguix
Every change you do to an INI file will only be updated when you use "FlushINI" (on Win9x). So if you write something to the INI file and you want to read it correctly you should use "FlushINI" before reading, deleting or renaming an INI file.

Logically, if you try to open an INI file after writting and before flushing it, you'll see that the INI file didn't change at all.

This sometimes should be looked as a feature, because with this you don't need to backup the file -> even when you try to write, you can still read the intact old version...

My Wiki Pages

Working now on:
New projects. (language: any)
deguix is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

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