|
From: Frederik E. <fre...@we...> - 2007-12-18 17:01:16
|
Am Dienstag, den 18.12.2007, 16:28 +0000 schrieb Michael Foord:
> Well - there are easy ways to add newlines to files. :-)
Right, I just did it like that. :-) I was just wondering if there was a
switch in configobj that I might have missed.
> Newline handling was actually quite tricky as ConfigObj is used to
> roundtrip files. I also prefer files terminated with a newline but
> wasn't aware it was part of the POSIX spec.
Well, I wouldn't swear it is, but I read this in a discussion on a
different list, and I think these definitions back up this oppinion:
Text file
A file that contains characters organized into one or more
lines. [...]
Line
A sequence of zero or more non- <newline>s plus a terminating
<newline>.
http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html
> Unless there are any objections I will add code to ensure that files are
> newline terminated. A side effect is that roundtripped files may gain a
> newline. Avoiding this would mean storing extra state when reading files
> and I don't *intend* to jump through those hoops.
Currently, there is the situation that files might loose a newline. So I
think that it's not worse to have files gain a newline. And I don't
think that applications will have problems with files that end with a
newline, so I'd totally agree that it's not worth the hassle to keep
that information.
Frederik
|