[net.micro.mac] Mac HFS & MFS directories

kk@amdcad.UUCP (Krishnakumar K.) (06/25/86)

     I am in need for assistance to do the following 1) Determine whether
the file system being used is MFS or HFS, then 2) depending on the file
system type, listing the files on the disk (MFS) or in a folder (HFS). Also,
is there a way to keep track of the home directory (the directory that the
application started from), so that it is not lost when the users selects a
file from SFPutFile or SFGetFile, which changes the default directory.
Any help would be appreciated.

Thomas Carstensen  -  Advanvced Micro Devices

phil@sivax.UUCP (06/25/86)

> 
>      I am in need for assistance to do the following 1) Determine whether
> the file system being used is MFS or HFS, then 2) depending on the file
> system type, listing the files on the disk (MFS) or in a folder (HFS). Also,
> is there a way to keep track of the home directory (the directory that the
> application started from), so that it is not lost when the users selects a
> file from SFPutFile or SFGetFile, which changes the default directory.
> Any help would be appreciated.
> 
> Thomas Carstensen  -  Advanvced Micro Devices

I am not sure about HFS/MFS stuff, I think there is a low core location for 
that, but...to remember the home directpry, you just do a PBGETVOL before
the get/put file calls, then do a PBSETVOL to put back to the home.


Phil Hunt
ucbvax!calma!sivax!phil

kk@dopey..UUCP (Krishnkumar) (06/26/86)

>      I am in need for assistance to do the following 1) Determine whether
> the file system being used is MFS or HFS, then 2) depending on the file
> system type, listing the files on the disk (MFS) or in a folder (HFS). Also,
> is there a way to keep track of the home directory (the directory that the
> application started from), so that it is not lost when the users selects a
> file from SFPutFile or SFGetFile, which changes the default directory.
> Any help would be appreciated.

I am using Manx C compiler.  (Inside Mac hasn't helped my yet)

Thomas Carstensen  -  Advanced Micro Devices

dwb@well.UUCP (06/28/86)

1)  HFS and MFS may be distinguished by examing the word at 0x3f6.  If it
	is less than 0 HFS is not installed.  It is called FCBLen.  ANd
	currently holds the maximum # of bytes necessary for an param
	block.

2)  The following code will work on either HFS or MFS.  It's purpose is to
	scan all the files in the volume/directory indicated by vRN.  Remember
	that vRefNum's can normally be either true vRefNum's or dRefNum's.

	errno = noErr;
	for(i = 1 ; errno == noErr ; i++)
	{
		fcb.ioCompletion = (ProcPtr) 0;
		fcb.ioVRefNum = vRN;
		fcb.ioFDirIndex = i;
		fcb.ioFVersNum = 0;
		fcb.ioNamePtr = (StringPtr) FileName;
		if((errno = PBGetFInfo(&fcb, 0)) == noErr)
		{
			/* Play with file */
		}
	}

	By the way, that's Lightspeed C so you will probably have to change
	the field names to make it work.

3)  Get a copy of the Software Supplements from Apple.  They tell you lot's
	of neat things about HFS and the Mac in general.
-- 
	David W. Berry
	dwb@well.uucp			dwb.Delphi
	dwb.GEnie			293-0544.408.MaBell

	DOWN WITH FASCIST APPLE!