[futurebasic] Re: [FB] Porting to Carbon question

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

From: Brian Stevens <brilor@...>
Date: Sat, 11 Mar 2006 18:54:49 -0700
On Mar 10, 2006, at 11:47 PM, Joe Lertola wrote:

> Do I really need to switch all my file references to FSSpecs?
This depends on lots of factors. If you are looking for just the  
quick fix then no. However, be advised that even FSSpecs are  
deprecated and probably soon to be dropped completely by Apple. The  
file references and their continued support by Staz should be viewed  
as a bridge of time until your code can be converted. Quick fixes now  
will mean just delaying the upgrades until later. Personally, I like  
to upgrade my code once. btw: carbon programs can use FSSpecs and  
FSRefs and your code is positioned for the future. So they will still  
run in OS 9. However, the reverse is not true. At some point  
technology relying old volume reference technology will break and it  
is probably sooner than later given Apple's recent efforts.



> I thought I read in the docs that Staz had made old file references  
> work under Carbon. Also what is an FSRef?
The following quote from Robert Purves explaining the history in a  
recent post might be helpful:

"Under MFS on the first Macs, files were identified by two  
parameters: name and volume reference number. When HFS superseded  
MFS, the directory structure required an additional parameter: the  
parID. The official way to identify a file then became the FSSpec,  
which contains all three parameters.  To allow MFS code to work under  
the new file system, Apple devised an hack known as a working  
directory. An unfortunate consequence was that many programs, even  
newly written ones, continued to use the old MFS API instead of  
switching to the new-in-1985 FSSpecs"

See <http://developer.apple.com/documentation/mac/Files/Files-85.html>

FSRefs have actually been around for a few years now and are  
essentially the successor to FSSpecs. More importantly, they are a so- 
called opaque structure that allows Apple flexibility in the future.  
Most of this is related or directly concerned with all the newer  
Apple Core Foundation (CF) technology and our ability to access it.  
If you aren't writing programs for OS X and specifically using  
Apple's new technologies such as CF and Quartz, you can probably relax.




>
> Where do you find out about functions like FSpDelete? I did not see  
> any references to that in the FB docs.
It is an Apple toolbox, as mentioned in the previous post. Staz  
typically doesn't duplicate Apple's documentation on the toolbox  
calls since it is so easy to just go to their web site. There are  
some examples with this toolbox call but I'm not sure if they are on  
the CD yet. The way to get toolbox information is go to the Apple  
Developer web site. It is free. Also, if you have XCode installed on  
your OS X machine, all the documentation is included, so there is no  
need to go to the Apple web site

>
> I would love to see more file examples. My program is a file  
> translator and it does a lot of fine manipulation.

Do you have the examples on the FB4 release 2 (the current release -  
GA) CD?  That would be a good start. If you have a specific need, I'm  
sure someone can post a snippet. Also, Alain's MoreXFiles, while  
advanced, might give you some ideas. Do you have it?

Brian S.