[futurebasic] Re: [FB] CFIndexRead using FSRef

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2008 : Group Archive : Group : All Groups

From: Brian Stevens <bstevens33@...>
Date: Sun, 27 Jan 2008 15:20:05 -0700
On Jan 27, 2008, at 6:32 AM, Steve wrote:

> So now that I can Iterate a folder using FSrefs, I would like to  
> know what is the fastest way to access a specific file in a  
> designated folder.  The folder may contain many thousands of files.
When you say "access a file" I assume you mean how do I obtain an  
FSRef to an existing file? I assume you already know how to access  
the file given an FSRef, right? Assuming that is correct, would you  
detail the specific conditions? In other words, can we allow the user  
to pick it via a Nav Services dialog? Must the program find it on its  
own without any user intervention?  Is there a starting point (i.e.  
starting directory) available? Please detail this if possible , and  
I'd really like to see the corresponding WD code used to find the  
file under the same conditions. I don't have the time in the next few  
days to write a general treatise, but an example for a more precise  
target might be doable.

>
> Using those god awful working dirIDs vref hacks with FB, it was  
> very easy to do.
See preceding comment. Show me the WD code and describe the precise  
conditions encountered.
>
> Brian, you showed me how to get at one file by name, inside a  
> folder inside the Documents folder, using the Fn IterateFolder.  I   
> can create an array of FSRef  of each file when iterating the  
> folder, then lookup the file in that array and use the FSRef,
If I understand correctly,  it sounds like the code might be doing an  
unnecessary step. If you know the name of the file to lookup in an  
array, just pass the file name to the iteratefolder fn and have it  
return the FSRef for that file. No need to fill the arrays and then  
search the arrays. I probably missed something here (or don't  
understand the question enough) since you would have thought of that.

Cheers...

Brian S.