Archive: Doc bug


Doc bug

4.9.5.3 FileRead
...
The string is read until either a newline (or carriage return newline pair) occurs...
This is incorrect; only the evil \r\n pair works.

Thanks, but next time search the forum for a thread named "typos in the docs". Just a hint.


Yes, if you could post it in this topic, the developers would be greatful.

-Stu


If this is true, it's a bug in the code and not the documentation. However, I can't reproduce this. The attached script works fine for me. Can you add more details?


Thanks Jason and Stu; I remembered reading that post but could not for the life of me remember the topic name or search pattern ( or the word 'typo' evidently :rolleyes: )

I have a file generated by a perl script which contains all files to uninstall. Originally I had set the script to print out to the uninstall log in this format (by mistake mind you-it should have been all \n's):

Modules\Mod1.mod\n
Modules\Mod2.mod\n
Modules\Mod3.mod\n
...
Voice\Mod1\Tom\mod1tom001.mp3\r\n
Voice\Mod1\Tom\mod1tom002.mp3\r\n
Voice\Mod1\Tom\mod1tom003.mp3\r\n
...
Global\script1.scr\n
Global\script2.scr\n
Global\script3.scr\n


The *.mod's were never removed and neither were the scripts or the first voice file. Changing end of line to \r\n fixes it. My loop:

Function un.removeFiles

ClearErrors
FileOpen $0 $INSTDIR\uninst.log r
FileRead $0 $1
removefiles:
StrCmp $1 "" removedone
StrCpy $1 $1 -1
Delete "$INSTDIR\$1"
FileRead $0 $1
Goto removefiles
removedone:
FileClose $0

FunctionEnd

Why you doesn't test kichik's script? Your loop:

!include "TextFunc.nsh"
!insertmacro un.TrimNewLines

Function un.removeFiles
ClearErrors
FileOpen $0 '$INSTDIR\uninst.log' r
IfErrors done

removefiles:
FileRead $0 $1
IfErrors close
${un.TrimNewLines} "$1" $1
Delete "$INSTDIR\$1"
Goto removefiles

close:
FileClose $0

done:
FunctionEnd