[Newbies] Re: FileDirectory
joseph.alotta at gmail.com
Wed May 25 23:46:51 UTC 2016
> Excellent. Remember that you should also look at the super classes for methods. UnixFileDirectory is the instance of “FileDirectory default” but it’s also a subclass of FileDirectory so the methods you can call include UnixFileDirectory and all the methods on the class hierarchy including the methods on FileDirectory. Please see the method categories on FileDirectory that I mentioned.
Okay, thanks. I tried to do something with that, but I got an error. I think I was trying to use a class method on the instance.
> The question I asked was a bit different. When you ask for the #entries of the instance “FileDirectory default” what class is each file?
It is an Array of DirectoryEntry objects.
> By the way, based on the question you asked there is a method on FileDirectory to determine if the file exists before you read it (it’s in the method categories I pointed out to you). What is that method?
I see what is happening. I thought the on: method changes the path, like cding a directory. But it gives a new instance.
dir := FileDirectory default.
dir on: '/Users/jja/Desktop’ ==> UnixFileDirectory on '/Users/jja/Desktop'
dir fileExists: 'categories.CSV’ ==>false
dir pathName ==>'/Users/jja/Desktop/Squeak-4.3-All-in-One.app/Contents/Resources'
dir := FileDirectory on: '/Users/jja/Desktop’ ==> UnixFileDirectory on '/Users/jja/Desktop'
dir pathName ==> '/Users/jja/Desktop'
dir fileExists: 'categories.CSV’ ==> true
So on: is the equivalent of new, in that it gives a new instance.
View this message in context: http://forum.world.st/FileDirectory-tp4897377p4897418.html
Sent from the Squeak - Beginners mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Beginners