[BUG][FIX?] FileDirectory
Doug Way
dway at eai.com
Mon May 8 23:58:49 UTC 2000
Stephan Rudlof wrote:
>
> BTW: I've found it annoying, that there isn't a - possibly - abstract
> class which handles Files and Directories unique and has some tests like
> - isExistingFile,
> - isExistingDir,
> etc. working with the path.
> Currently you have to be careful:
> If you say FileDirectory on: '/tmp/foo' you get a FileDirectory with
> '/tmp' and don't know if 'foo' is a dir or a file.
I agree. I'd go a bit further and say that the FileDirectory stuff is a mess,
it's probably my least favorite class in all of Squeak.
The main problem is that you can't simply represent a single file name with an
object. You could then send this object simple messages such as "delete",
"exists", "openAsStream", "renameTo:", etc. With FileDirectory, you have to
pass the name of the file as a parameter for most of its messages, which seems
rather un-OO. If I want to keep track of a file, I need to store both the
FileDirectory and the name of the file separately. (I haven't used VisualWorks
in a few years and have forgotten most of it, but I still fondly remember the
way it handled file names. :-) )
Perhaps I'm overstating things... but I only deal with files occasionally in
Squeak, and it always seems to take me a while to figure out how to do
something.
Even just an abstract class which handles something like "isExistingFile" and
"isExistingDir" would be helpful, as you suggest... I guess I'd have to think
about what the best hierarchy would be for implementing this...
I know, I know, I should post a changeset rather than complain. :-) Didn't
Craig Latta or someone post some sort of improved file name handling changeset
awhile ago? (I guess changing this would require a lot of cleanup in the base
image...)
- Doug Way
EAI/Transom Technologies, Ann Arbor, MI
http://www.transom.com
dway at mat.net, @eai.com
More information about the Squeak-dev
mailing list
|