A quick question about file URLs
Matthew S. Hamrick
mhamrick at cryptonomicon.net
Mon Nov 14 12:42:01 UTC 2005
Hey all..
Here's a quick question. I've tracked it down a bit, but it looks
like it could quickly turn into a little bit larger of a project than
what I was hoping. So before I start down that rabbit hole, I figured
I would ask here... I'll try to phrase it in a yes or no answer so
someone with a little more experience with the file handling code can
make a quick reply...
The Problem
I like URLs. I have a tool that wants to grab a stream from an URL
and do interesting things with the results. I recently noticed a
problem with FileUrls. If I do a:
( 'http://www.cryptonomicon.net/index.html' asUrl )
retrieveContents ,
I get a very nice MIME document from which I can extract contents.
Now if I'm working with a local file and I do the following...
( 'file:///Users/mhamrick/sites/cryptonomicon.net/index.html'
asUrl ) retrieveContents ,
I get an UndefinedObject back. I've traced the problem to the line:
FileDirectory default
which on my MacOS X machine returns an object of class
MacHFSPlusDirectory. Looking further in the code, I find places where
I believe some code wants to receive pathnames with slashes '/',
while other places the system seems to think that the classic ':'
colon is the file delimiter to use. I believe this confusion is
causing the problem.
The Questions...
a. Could someone be so kind as to create a file somewhere ( I'm
calling it 'test.txt' ) and see if the following code returns a
document...
('file:///test.txt' asUrl) retrieveContents
I don't have a non-Mac machine to test this on... Though I'm thinking
I should spend a little time recompiling the Squeak VM against the
MacOSX X11 libraries.
b. Is the MacOS X version of FileDirectory really supposed to return
a MacHFSPlusDirectory? Shouldn't it return a UnixFileDirectory?
c. How is the DefaultDirectory and DirectoryClass set in the image? I
chased this as far as looking at the
MacHFSPlusDirectory>>isActiveDirectoryClass and discovered that it
appears to be looking at how long a single file can be. This seems
odd as I would have expected other OSes (like Linux and XP to
exercise this code as well.)
d. Is this supposed to be broken? I mean, is this a known problem but
it's behavior that's being maintained for reverse compatibility or
something?
Any pointers would be appreciated.
-Cheers,
-Matt H.
More information about the Squeak-dev
mailing list
|