Directory listing on Mac
Brian Murphy-Dye
brian.murphydye at mac.com
Sat Mar 20 22:38:06 UTC 2004
This may or may not help, but by combining thoughts from others on this
topic, I added an #onMac: method to FileDirectory. It works similarly
to the #on: method, so that:
(FileDirectory onMac: '/Users') directoryNames
returns a collection of directory names in the /Users directory and
(FileDirectory onMac: 'images') fileNames
returns a collection of file names in the images directory inside the
place where the image is. Though I have yet to test it, it should work
under Linux as well.
onMac: pathString
"Return a new file directory (even on Mac OS/X) for the given path, of
the appropriate FileDirectory subclass for the current OS platform."
| newPathString |
FileDirectory pathNameDelimiter = $: ifFalse: [^ self on: pathString].
newPathString := pathString replaceAll: $/ with: $:.
^ FileDirectory on: ((newPathString at: 1) = $:
ifTrue: [(FileDirectory default pathName subStrings: ':') first,
newPathString]
ifFalse: [FileDirectory default pathName, ':', newPathString])
On Mar 20, 2004, at 11:11 AM, stéphane ducasse wrote:
> may be this related but I cannot see files that are located in another
> volumes on mac.
> In fact I can only see the part of the file tree that leads to the
> place where the image is.
> I do not know if this is just me but this is strange.
>
> Stef
>
>
More information about the Squeak-dev
mailing list
|