Skip to content
⌘ NSIS Forum Archive

filewrite writing half a var?

7 posts

empezar#

filewrite writing half a var?

i get this output in install.log

x C:\fQuake-teaser x libjpeg.dll x (new line)
rge.net\docs\pics\particle_muzzleflash.jpg x (new line)
x C:\fQuake-teaser x ezquake\manual\ezquake.sourceforge.net\docs\pics\nailtrail_plasma.jpg x (new line)

when i use this code:

  nsisunz::UnzipToStack "${DISTFILES_PATH}\$R0" "$INSTDIR"
Pop $0
${If} $0 == "Error opening ZIP file"
DetailPrint "Extraction Error: $0"
${Else}
FileOpen $R0 $INSTDIR\${INSTLOG} a
${DoUntil} $0 == ""
ClearErrors
${Unless} $0 == "success"
FileWrite $R0 " x $INSTDIR x $0 x"
FileWriteByte $R0 "13"
FileWriteByte $R0 "10"
DetailPrint "Extract: $INSTDIR\$0"
${EndUnless}
Pop $0
${LoopUntil} $0 == ""
FileClose $R0
${EndIf}
how can it not extract "x $INSTDIR x " and then only half of the $0 variable?!

i just can't figure this one out
empezar#
i found what's wrong, but i don't understand why

the file is exactly 110 053 bytes in size, and will NOT go past that, obviously.
empezar#
i have 2 sections of this code i wrote up there.

alone, they can write everything to the log. but together, they go past 110 053 bytes, and starts overwriting stuff in the text file instead of adding.

so if the text file looked like this:

hello
hello
hello

and i add "zip" to the text file, it would look like this:

ziplo
hello
hello
Afrow UK#
Rather than re-open the log file twice, have a hidden Section before the first section to open the log and another after your sections to close it.

-Stu
Afrow UK#
FileOpen with append does not append data to the end of the file. You must move the open pointer to the end of the file first with FileSeek $Var 0 end.

Now you're opening the log file only once, so make sure you use 'w' not 'a' now.

-Stu