JasonFriday13
2nd January 2009 10:58 UTC
FileRead bug (I hope)
What I am doing is looping a FileRead command to read one line at a time from a text file. But I am finding extra characters at the end of the string. I have attached a test script which replicates the problem. I am using nsis 2.42.
JasonFriday13
2nd January 2009 11:02 UTC
And a screenshot when run on my machine (Win XP SP2)
Yathosho
2nd January 2009 11:55 UTC
i'm not on windows now, but two characters at the end of the line - that sounds a lot like "$\r$\n". i remember there is a function on the wiki to get rid of those.
JasonFriday13
2nd January 2009 12:05 UTC
Thats right. Its even worse because in my proper script, the strings are filenames with absolute paths. I am passing these to exewait with makensis (to compile them). Makensis always stops with an error (example):
Can't open script "C:\test.nsi
"
Can nsis be fixed or do I have to chop off those characters manually?
Animaether
2nd January 2009 13:26 UTC
Well there's nothing there to fix - it's reading the entire line, which includes control characters, from the file just like you're instructing it to :)
Anyway - yes, you'd have to strip them off yourself;
http://nsis.sourceforge.net/StrTrimNewLines
( same functionality is in StrFunc.nsh that comes with NSIS )
JasonFriday13
2nd January 2009 14:43 UTC
Thanks alot.