[Mac] VM - Can Someone Please Explain this Code?

Karl Goiser squeak at wattle.net
Sat Jan 6 06:38:30 UTC 2001


G'Day,

In sqMacDirectory.c, there is a function (and comment):

int lookupPath
  (char *pathString, int pathStringLength, int *refNumPtr, int *volNumPtr)
    /* Resolve the given path and return the resulting folder or volume
       reference number in *refNumPtr. Return false if the path is bad. */

What the code does is to walk the path hierarchy checking that the directory
exists at each level.

Can someone please tell me why it needs to do this?  After all, can't you
just throw the path at PBGetCatInfoSync() and it will tell you if it was
valid?


Here is the long discussion of why I am asking in case you are interested:

Given a path,

Volume:Directory1:Directory2:Directory3

The code will call the function lookupVolume() with the volume name as the
parameter to check for a valid volume name.  Then it will call
lookupDirectory() for each directory, also passing the parent directory
number:

Directory1,         0
Directory2,         Directory1's id
Directory3,         Directory2's id

Ok so far?

When I run this code under Carbon in OS X, the code doesn't work.

The call to lookupDirectory() for Directory1 fails because it looks in the
default directory (i.e. the directory of the Squeak application) instead of
the root lovel of the volume (as it does in OS 9).


Hence the reason for my question.


Thanks for listening...


Karl





More information about the Squeak-dev mailing list