[ENH] FileList use of CrLf conversion for text files

Lex Spoon lex at cc.gatech.edu
Thu Jul 22 00:48:34 UTC 1999


Man, referencing CrLfFileStream directly doesn't make sense if it's alraedy the default.  If it's the default, what you want to do is swap between using ascii mode and binary mode.  Binary mode makes no changes, and ascii mode does lots of nice but safe changes.  This all works perfectly, precisely as long as you accurately set the mode on the stream.  (And don't change it midstream)

In practice, it seems to work pretty well as is, even though most existing code isn't that careful about ascii versus binary mode.  (Instead, most code seams to use these modes as convenient ways to get bytes versus characters, but that actually tends to put it in the right mode, anyway).

So, have you thought before about just using CrLfFileStream as your concreteStream?


Lex



Tim Rowledge <rowledge at interval.com> wrote:
> Both my Linux and Acorn machines use LF as a line-end, so the squeak FileList
> makes hash of any non-ST code file. Currently FileList checks for a moderate
> list of file suffix/types in order to allow the gif reading / flash loading /
> etc, so I simply added 'c' & 'h' to the list needing special treatment and use
> a CrLfFileStream.
> 
> A trivial and partial fix is enclosed, but I have this feeling that it would
> probably be better to
> a) assume that a file of any not-previously-known type is local line-end format
> b) check for 'cs' as a file suffix in order to _not_ convert.
> 
> However, that seems a touch more contentious a change that ought to have more
> discussion. Maybe 'image' and 'changes' would be worth marking for not-
> converting, probably 'exe' (hey, maybe 'exe' ought to be loaded as hex by
> default?) and so on.
> 
> tim
> 
> -- 
> Why Dogs Hate WIn95:-  6)  SmellU-SmellMe still in beta test.
> Tim Rowledge:  rowledge at interval.com (w)  +1 (650) 842-6110 (w)
>  tim at sumeru.stanford.edu (h)  <http://sumeru.stanford.edu/tim>





More information about the Squeak-dev mailing list