[futurebasic] Re: [FB] Folder question

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2006 : Group Archive : Group : All Groups

From: Brian Stevens <bstevens33@...>
Date: Mon, 6 Nov 2006 21:48:20 -0700
You're welcome.  Of course, the doDialog fn and the FInfo dim in main  
are unnecessary for the demo. I just forgot to remove them.

Brian S.
On Nov 6, 2006, at 9:29 PM, Joe Lertola wrote:

> Brian,
>
> Thanks so much. I actually spent an hour looking at MoreFilesX.incl  
> before I posted my question, but I could not figure out how to use  
> it to get this information.
>
> -Joe
>
> On Nov 6, 2006, at 10:59 PM, Brian Stevens wrote:
>
>>
>> On Nov 6, 2006, at 6:01 PM, Joe Lertola wrote:
>>
>>> Hi all,
>>>
>>> I have a fsSpec for a folder. How can I get the fsSpec for the  
>>> parent folder that contains that folder?
>>
>> Joe,
>>
>> Warning: this is a quick hack. Check it for coding errors. Seems  
>> to work with very brief testing.
>>
>> Brian S.
>>
>>
>>
>> include "Tlbx MoreFilesX.incl"
>>
>> local mode
>> local fn FSRefMakeFSSpec( fsRef as ^FSRef, fs as ^FSSpec )
>> '~'1
>> dim as OSErr  err
>>
>> err = fn FSGetCatalogInfo( #fsRef, _kFSCatInfoNone, #0, #0, #fs, #0 )
>> end fn
>>
>>
>> local fn ChooseFolder
>> dim as FSSpec  @ fs
>> dim as FSRef   @ folderRef, oRef
>> dim as OSErr  err
>> dim as str255 name
>> name = files$( _FSSpecFolder, "Pick a Folder",, fs )    // get  
>> FSSpec of current folder
>> err = fn FSpMakeFSRef( #fs, @folderRef )              // get FSRef  
>> for FSSpec of current folder
>> // Get FSRef of parent directory
>> err = fn FSGetCatalogInfo( @folderRef, _kFSCatInfoParentDirID, #0,  
>> #0, #0, #oRef )
>> // FSRef of parent to FSSpec
>> fn FSRefMakeFSSpec( @oRef, @fs )
>> end fn = fs
>>
>> local fn DoDialog
>> '~'1
>> dim as long   ev, id
>>
>> ev = dialog( 0 )
>> id = dialog( ev )
>> select ev
>> case _wndClick : window id
>> end select
>> end fn
>>
>> dim as FSSpec gFSSpec
>> dim as OSErr  gErr
>> dim as FInfo  info
>>
>> gFSSpec = fn ChooseFolder
>>
>> print gFSSpec.name
>>
>> do
>> HandleEvents
>> until ( 0 )
>>
>> --
>> To unsubscribe, send ANY message to: futurebasic- 
>> unsubscribe@...
>>
>
> --
> To unsubscribe, send ANY message to: futurebasic- 
> unsubscribe@...
>