[futurebasic] Re: [FB] Level with me.

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : June 2003 : Group Archive : Group : All Groups

From: Robert Covington <artlythere@...>
Date: Fri, 13 Jun 2003 08:22:20 -0400
On Friday, June 13, 2003, at 07:35  AM, Alain Pastor wrote:

>
>
> Robert Covington wrote:
>> One level down.. :)
>> Carbon, OSX, appearance:
>> When I use FinderInfo, and send the result of a drag and dropped 
>> folder  to USR Scanfolder, I am getting the next directory up 
>> scanned, not that  folder. Seems like a dirID oneupsmanship thing.
>> Guess: The Filename returned is that of the folder, but apparently, 
>> the  vRefNum (WD) / DirID  is that of the folder containing the 
>> dropped  folder (sort of makes sense, but not helpful).
>> So , when I use FN FBMakeFSSpec() for a folder on the desktop, I 
>> don't  get that folder scanned,  I get a scan of the whole desktop. 
>> (FN  FSMakeFSSPEC fails in carbon, FN FBMakeFSSpec does the whammy 
>> jammy, or  maybe it's the problem with whammying my jammy)
>> How does one get the dirID that is the next level down so to speak,  
>> attached to the dragged folder? None of my old ways are lining things 
>>  up correctly.
>> Any clarification of this big pain is a big help. A nav choose folder 
>>  FspecOpen works fine with the same search FN.
>
> Robert,
>
> If you use USR ScanFolder, the scan must start with a _file_ located 
> within the folder to scan. So, in your case the DirID of the selected 
> folder must be the parID of all the files to retrieve.

I see.... but NavChooseFolder FSpec gives me good results with the same 
scan fn,  when I don't select a file (I just click the folder and 
select Choose , nothing's hilited in the folder display.  Must be the 
all FSSpec nature of that.

> But, if you have an FSSpec of a folder to start with, its parID field 
> contains the dirID of the folder where it is itself located, thus the 
> search starts at the same level as the folder you have chosen.

As I thought.

> The solution is to fake the FSSpec of a file that would be located in 
> the folder you want to scan. You can retrieve the dirID of the folder 
> which must become the parID of that dummy file with the following (I'm 
> not sure to be clear) :


Tried making a dummy file... either I get an error, or the thing scans 
the same higher level.... Things like this make me want to blow up 
entire solar systems.

Aha!  Universe may live another day...

Cheating works...!!  I subbed the parID from your FN back into the 
FSSpec already created for the folder, now it scans correctly. Darn, I 
could have done that the other day, didn't think to try it.


DIM parID as long
// Finder Info seems to return a WDref num and no ParID, which thus 
requires FBMakeFSSpec in Carbon, not FSMakeFSSpec

Long if fn FBMakeFSSpec(vRefNum%,0,fileName$ ,myFileSpec) = _noErr // 
wrong ParID
parID = FN GetFolderDirID( myFileSpec, 0 ) // Get correct one
myFileSpec.parID = parID // manually set a field you aren't supposed to 
manually set.
FN AutoSearchVolume(myFileSpec,1) // now works!
Xelse
Stop "Bad FolderSpec"
End if

Things are leveling out now. Thanks Alain. I can get Slide Freebie out 
now that this is whacked. Released Compositor v2.4 today. OS X version 
next in line.

Robert




> CLEAR LOCAL MODE
> '~'8
> LOCAL FN GetFolderDirID( fldSpec AS .FSSpec, canCreateFolder AS 
> BOOLEAN )
> '~'9
> DIM @ dirID AS LONG
> DIM   fld   AS FSSpec
> DIM   pb.108
>
> SELECT FN FSMakeFSSpec( fldSpec.vRefNum, fldSpec.parID, fldSpec.name, 
> fld )
> CASE _noErr
> pb.ioNamePtr&   = @fldSpec.name
> pb.ioVRefNum%   = fldSpec.vRefNum
> pb.ioDirID&     = fldSpec.parID
> IF FN PBGetCatInfoSync( pb ) THEN EXIT FN
> dirID = pb.ioDirID&
>
> CASE _fnfErr
> LONG IF canCreateFolder
> LONG IF FN FSpDirCreate( fld, _smCurrentScript, dirID ) != _noErr
> EXIT FN
> END IF
> END IF
> END SELECT
>
> END FN = dirID
>
> Alain