[Seaside] [file libraries] Write to disk feature

Sebastian Sastre ssastre at seaswork.com
Wed Aug 22 20:14:15 UTC 2007


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

 

 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20070822/979be58d/attachment.htm


More information about the seaside mailing list