[IDEA]Central file management by .ext / mime-type.
Sean Charles
bibbers at onetel.net.uk
Sat May 3 21:45:16 UTC 2003
In a nutshell: A file manager object that can know of all file types and
be THE single point of contact for creating filenames, management blah
blah blah...
FooMgr mimeTypeFor: aString.
FooMgr extensionsFor: aMimeType.
FooMgr servicesFor: etc etc etc
I'm sure you guys get the idea. Is there something near to it / planned
already?
Having just submitted a small enhancement cs, I spent some time rummaging
around and it seems that, in general, file handling by extension is a bit
rough around the edges. Although the FileList / SimpleServiceHandler
mechanism is great (I use it a lot for various utilities I've written
where I drop things from the Finder into Squeak and it munges them as
required) the actual implementation code seems to use a lot of scattered,
hardcoded file extensions which sometimes leads to hit and miss operation.
The initial source of my troubles was Morph>>exportAsJPEG which tacked
'.jpeg' onto the filename, I could have changed it by why should I have to
every time? The simple hack is changing it here I guess but I never do
things the easy way. It was a surprise to see that Scamper wouldn't
recognise .jpeg files resulting in a call to displayImagePage.
I'd consider changing .jpeg to .jpg as it is the more common extension,
and more to the point, recognised by FileList out of the box unlike .jpeg.
You can save em but you can't get em back! *8-). Possibly a moot point
this one as most external programs should handle either extension. If not,
ditch it!
Interestingly enough, we have the *raw* beginning of something in
Utilities class>>graphicsFileSuffixes which, to save you looking, is:
graphicsFileSuffixes
"Answer a list of filename suffixes which signal file content which we
are able to internalize"
^#('.gif' '.bmp' '.jpg' '.jpeg' '.jpe', '.form')
In my image, it's called twice! I also note that .jpe is given, which is
also notoriously flaky too. I jut didn't bother with that as I've never
seen one ever!
Sean Charles.
More information about the Squeak-dev
mailing list
|