Directory listing on Mac

Brian Murphy-Dye brian.murphydye at mac.com
Thu Mar 18 22:08:11 UTC 2004


Thanks for the help. This does work:
     '(FileDirectory root directoryNamed: ':Macintosh HD:Users') 
directoryNames'
so I can munge something together.

Interestingly, Monticello works fine with normal unix paths, so I was 
hoping I was just using the wrong command.

Brian Murphy-Dye


On Mar 18, 2004, at 4:47 PM, Ned Konz wrote:

> On Thursday 18 March 2004 1:24 pm, Brian Murphy-Dye wrote:
>> I see that 'FileDirectory default directoryNames' returns an Array of
>> directory names located in the image directory. On a Mac OS/X system,
>> how do I find the directories in the '/Users' directory?
>
> I hope you only have one /Users directory.
> There's nothing to keep someone from making one in each volume.
> Is there some way to distinguish *which one* you want to find?
> I don't know that we have a good way to distinguish the active boot 
> volume
> from Squeak.
> Though I suppose you could look for the other top-level directories
> (perhaps /tmp or /var ?) to see if various tell-tale files/dirs exist.
>
> to find the top volume (the parent of (some) /Users directory):
>
> topVolumes := (FileDirectory root) directoryNames select: [ :name |
> (FileDirectory on: name) directoryExists: 'Users' ].
> topVolumes size > 1 ifTrue: [ self error: 'now what? more than one 
> Users
> directories!' ].
> usersDirectory := FileDirectory on: topVolumes first.
> directoryNamesUnderUsersDirectory := usersDirectory directoryNames.
> directoriesUnderUsersDirectory := directoryNamesUnderUsersDirectory 
> collect:
> [ :dirname | usersDirectory directoryNamed: dirname ].
>
> -- 
> Ned Konz
> http://bike-nomad.com/squeak/
>




More information about the Squeak-dev mailing list