Mariano Martinez Peck wrote:
Hi list!
I need to do some things with files (text and binaries), and I would need information about creating, deleting, adding, appending, writting and so on with them. I look in SBE but I didn't find a chapter about that.
Is somewhere documentation about this?
thanks,
Mariano
The built in File handling is not very elegent, enter, "Rio" File/Drectory
Installer squeaksource project: 'Rio'; install: 'File-Kernel'; install: 'File-Base'.
(and File-Tests for examples)
see also http://wiki.squeak.org/squeak/5929
if you like it, then perhaps you would be kind enough to offer some feedback
best regards
Keith
========= Class comment from File reads:
Features of File/Directory (née Rio)
File/Directory was inspired by ruby's rio which enables local and remote files to be used transparently. To achieve this a generic stream copy function has been developed (aStream copyTo: bStream) and we are able to expose the working stream of FtpClient so you can stream directly to a remote file. We also support file archives (zip) as if they were a filesystem, and transparent streaming to compressed files (gzip). [transparent streaming to a remote compressed file is still available as a exercise for the reader to implement ;) ]
File/Directory is a standalone package, it does not use any of the existing FileDirectory classes. It is separated into File-Kernel and File-Base, where the former provides a minimal working subset for KernelImages to access local filesystems.
Local file copying is handled by the fileCopyPlugin if it is present, if not OSProcess 'cp' is used, and as a last resort a full stream to stream copyTo: is performed (but this does update modification time).
Remote file upload or download is handled by OSProcess 'ftp' if it is present. Multiple file transfers are invoked N at a time (where N is initially 5). Copying from a remote file to another remote file is handled by the internal stream copy function.