Archive: Filewrite???


Filewrite???
  I think I have found a error in NSIS. Because I will write a file for 4 sections, this should only write when activ. But wenn all activ than writes some good and some not. (I'm out germany my english not good in grammer.)

section1:
FileOpen $5 $INSTDIR\cstrike\valve.rc a
FileWrite $5 "s_refgain 0.4$\r$\n"
FileWrite $5 "s_verbwet 0.25$\r$\n"
FileWrite $5 "s_distance 60$\r$\n"
FileWrite $5 "stuffcmds$\r$\n"
FileWrite $5 "exec waffenscript\Waffenkauf.cfg"
FileClose $5
section2:
FileOpen $5 $INSTDIR\cstrike\valve.rc a
FileWrite $5 "$\r$\nexec waffenscript\Radio.cfg"
FileClose $5
section3:
FileOpen $5 $INSTDIR\cstrike\valve.rc a
FileWrite $5 "$\r$\nexec waffenscript\Sonstige.cfg"
FileClose $5
section4:
FileOpen $5 $INSTDIR\cstrike\valve.rc a
FileWrite $5 "$\r$\nexec waffenscript\cache\allcache.cfg$\r$\n"
FileWrite $5 "exec waffenscript\cache\cache.cfg$\r$\n"
FileWrite $5 "exec waffenscript\cache\slots.cfg"
FileClose $5

That is not the complete script, this is not the correct kind it to write. Is this correct with the $\r$\n , I can not found a difference of both.

In the file valve.rc is in it:


exec waffenscript\cache\allcache.cfg
exec waffenscript\cache\cache.cfg
exec waffenscript\cache\slots.cfg


For complet script from start to end, please answer.
When only the first section activ than is all ok.
Pleas help.

So must come it out:

s_refgain 0.4
s_verbwet 0.25
s_distance 60
stuffcmds
exec waffenscript\Waffenkauf.cfg
exec waffenscript\Radio.cfg
exec waffenscript\Sonstige.cfg
exec waffenscript\cache\allcache.cfg
exec waffenscript\cache\cache.cfg
exec waffenscript\cache\slots.cfg

The nsi file is attach.


You forgot to use FileSeek to reach the end of the file.


FileSeek $5 0 EOF 

>