Alternative directory/file classes?

John M McIntosh johnmci at smalltalkconsulting.com
Tue Mar 13 22:23:54 UTC 2007


On Mar 13, 2007, at 2:48 PM, J J wrote:

> I thought it was proposed as a complete replacement of the existing  
> file handling stuff.  The URI idea isn't bad, but how would that  
> work?  Seems kind of redundant to have to type "file://" all the  
> time to a class that only handles files.

In Sophie we store references to external data as a URI object.

There is a platform specific class that looks after fetching the URI  
for say the temp directory, the vm directory, the document directory  
for the platform you are running on.

Thus to open a file in the document directory we take the document  
directory, resolved that against the relative URI part of the  
document name, then take the resolved URI and ask it for say a read/ 
write UTF8 stream.

The Sophie Resource manager stores relative URI's which point to data  
as relative paths based on the URI of the book, or absolute URIs  
which point
to files or internet resources. Naturally we don't suggest people use  
absolute URIs for file based media, we even have a URI to indicate a  
path is a absolute path to a memory
file stream stored in the memory based book model logic.

This model then allows us to open a book (foo.spbf) either on a local  
hard drive, or via a http://  URI without further work since the
URI logic looks after the deals of making a stream,  
StandardFileStream/UTF8 or HTTP stream, ftp, etc....

--
======================================================================== 
===
John M. McIntosh <johnmci at smalltalkconsulting.com>
Corporate Smalltalk Consulting Ltd.  http://www.smalltalkconsulting.com
======================================================================== 
===





More information about the Squeak-dev mailing list