🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #1539

Re: Saving vRefNum's

#1539
From: Alex D. Chaffee,231 Votey,,65812...
Date: Tue, 18 Jul 1989 05:23
48 lines
1739 bytes
From article <84039@ti-csl.csc.ti.com>, by leeke@m2.csc.ti.com (Steve Leeke):
> I would like to be able to recursively scavange a directory for a
> certain type of file and save the vRefNum when a file of a certain
> type is found.  I've included to code I'm using by it seems to cause
> problems since the working directory is closed after I save the
> vRefNum, but if I leave it open I wind up with too many working
> directories open.  Any suggestions?
> 
> Thanks,
> 
> Steve Leeke
> leeke@m2.csc.ti.com

How about...
 int scavengeDirectory(dirName,vRefNum,wPtr)
...
 {
	Boolean	DeleteWD = true;
...
 	result	=	0;
...
 	do {
...
 		} else {
 			if (dirRec.ioFlFndrInfo.fdType == XPRCSignature) {
 				/*	Save vRefNum	*/
/* return the vRefNum if it was found, else return 0 */
 				result	=	dirWDRec.vRefNum;
				DeleteWD = false;
 			};
...
 		} while (err != fnfErr && !result);

/* don't delete the WD if it contains our file */
 		if (DeleteWD)
			PBCloseWD(&dirWDRec,false);
 	};
 
 	return(result);
 };

Of course, you could go one step further...
		if (!result) PBCloseWD(...)
and do away with DeleteWD.

Alex Chaffee
chaffee@emily.uvm.edu
____________________________
Technical Details
Message-ID: <1228@uvm-gen.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!uunet!uvm-gen!chaffee
References: <84039@ti-csl.csc.ti.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!iuvax!cica!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!ginosko!uunet!uvm-gen!chaffee
From: chaffee@uvm-gen.UUCP (Alex D. Chaffee,231 Votey,,6581273)
Newsgroups: comp.sys.mac
Subject: Re: Saving vRefNum's
Message-ID: <1228@uvm-gen.UUCP>
Date: 18 Jul 89 05:23:07 GMT
References: <84039@ti-csl.csc.ti.com>
Sender: nobody@uvm-gen.UUCP
Organization: EMBA Computer Facility, Univ. of Vermont, Burlington.
Lines: 48
Followups-to: comp.sys.mac.programmer