[Seaside] [file libraries] Write to disk feature (bugfix for the
bugfix)
Sebastian Sastre
ssastre at seaswork.com
Wed Aug 22 20:20:26 UTC 2007
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 ]
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20070822/13292795/attachment-0001.htm
More information about the seaside
mailing list