A quick question about file URLs

Michael Rueger m.rueger at acm.org
Tue Nov 15 09:56:38 UTC 2005


John M McIntosh wrote:

> However for the record
> 'file:///test1.txt' asURI   retrieveContents
> gives me a DNU on nil

which is "correct"
retrieveMIMEDocument: uri
	| file |
	file  _ [self contentStreamForURI: uri]
			on: FileDoesNotExistException do:[:ex| ex return: nil].
	file ifNotNil: [^MIMEDocument contentStream: file mimeType: (MIMEType 
forExtension: uri extension)].
	^nil

the question is though if we should actually catch the file exception at 
that point. Which I think we shouldn't.


> and
> 'file://test1.txt' asURI   retrieveContents
> returns the directory records content for root, *that is interesting*.

Hmm, the above uri is actually pointing to a host "test1.txt", not to a 
file.
'file:///test1.txt' does, namely to test1.txt in the root directory.

Michael



More information about the Squeak-dev mailing list