[Seaside] [file libraries] Write to disk feature (bugfix for the bugfix)

Philippe Marschall philippe.marschall at gmail.com
Wed Aug 22 21:16:24 UTC 2007


2007/8/22, Sebastian Sastre <ssastre at seaswork.com>:
>
>
> Please ignore my previous buggy bugfix :P
>
> Here is one that was tested:
>
> write: aStringOrByteArray toFile: aFileNameString inFolder: aFolderString
>  "Writes aStringOrByteArray to a file named aFilenameString in the folder
> aFolderString.
>  Note: if aStringOrByteArray is a string it writes a CR LF kind of file and
> binary otherwise"
>  | folder stream fullFilePath |
>  folder := FileDirectory default directoryNamed: aFolderString.
>  fullFilePath := folder fullNameFor: aFileNameString.
>  stream := aStringOrByteArray isString
>   ifTrue: [ (CrLfFileStream forceNewFileNamed: fullFilePath) ascii]
>   ifFalse: [ (FileStream forceNewFileNamed: fullFilePath) binary].
>  [ stream nextPutAll: aStringOrByteArray ]
>   ensure: [ stream close ]

D'oh! Fixed.
Thx

Cheers
Philippe

> It's not a big thing but will be friendly for the web interface that one
> could select several libraries and press a button like "write to disk
> selected libraries"
>
>     cheers,
>
>
>
> Sebastian Sastre
>
>
>
>
>  ________________________________
>
> De: seaside-bounces at lists.squeakfoundation.org
> [mailto:seaside-bounces at lists.squeakfoundation.org] En
> nombre de Sebastian Sastre
> Enviado el: Miércoles, 22 de Agosto de 2007 17:14
> Para: 'Seaside - general discussion'
> Asunto: [Seaside] [file libraries] Write to disk feature
>
>
>
>
> Hi there,
>
>     there is a bug in writing libraries to disk (a conditional for binary
> and plain text is inverted). Here is a patch I'm using:
>
> SeasidePlatformSupport>>write: aStringOrByteArray toFile: aFileNameString
> inFolder: aFolderString
>  "Writes aStringOrByteArray to a file named aFilenameString in the folder
> aFolderString.
>  Note: if aStringOrByteArray is a string it writes a CR LF kind of file and
> binary otherwise"
>
>  | folder stream fullFilePath |
>  folder := FileDirectory default directoryNamed: aFolderString.
>  fullFilePath := folder fullNameFor: aFileNameString.
>  stream := aStringOrByteArray isString
>   ifTrue: [ (CrLfFileStream forceNewFileNamed: fullFilePath) binary ]
>   ifFalse: [ (FileStream forceNewFileNamed: fullFilePath) ascii ].
>  [ stream nextPutAll: aStringOrByteArray ]
>   ensure: [ stream close ]
>
>     cheers,
>
>
>
> Sebastian Sastre
>
>
>
> _______________________________________________
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>


More information about the seaside mailing list