[futurebasic] Re: [FB] FSSpecs vs FSRefs

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

From: andy@...
Date: Sat, 26 Jan 2008 10:01:45 -0000 (UTC)
Hi Brian / Robert,

I am finding it hard to track down the documentation on FSRefs. Is any
written? Or some examples?

Within the FB Help, throughout the examples and in the Appendix on files
talks about VolRefs (and hey, I still use them!) :-)

Within http://4toc.com/fb4/FBtoCHelp/pgs/adapting there is a section that
says:

"In Carbon, a file may be identified by:

    * name, vRefNum and dirID [deprecated]
    * FSSpec, which combines the 3 above in one record [deprecated]
    * FSRef
    * CFURLRef
    * path in UTF-8 encoding"

(Then proceeds to give an FSSpec example).

I know about VolRefs (and FSSpec) but they are both deprecated and I would
like to take your advice and jump straight to FSRef but I cannot find any
reference on using FSRefs direct. I have found some of RP's examples where
there is a translation from FSSpec to FSRefs.

RC, if you love FSRefs do you have examples of the things I do all the
time in my program (and I'm sure most basic programs):

Locate application volume
Goto Sub folder
Let user select folder
Open file for Read
Read file
Open file for Write
Write file

Perhaps we could then write them to the FBtoC docs...

I haven't kept up with what Apple is developing behind the scenes. I don't
even know what CFURLRef is? (internet access?) Or UTF-8 encoding.

Regards

Andy


> I love FSRefs (FSSpecs are spiffy other than the filename length
> issue though), would be nice if we had a convention for a keyword
> based return of an FSRef for a non-existent file. Such are often
> needed for various purposes.
>
> It could be like,
>
> FSRef = USR MakeFSRef
>
> Alas, I know the support code behind that would be like, 3 pages
> long. :) (have seen the apple demo code for such a case of the non-
> existent file case)
>
> Robert
>
>
> On Jan 23, 2008, at 10:39 AM, Brian Stevens wrote:
>
>>
>> On Jan 23, 2008, at 2:12 AM, Ken Shmidheiser wrote:
>>
>>> With the recent discussions concerning FSSpec vs FSRefs,
>>
>> Just two quick points for all FBers using files with FBtoC:
>>
>> 1) Please read the FBtoC help docs. The OPEN verb, for example, is
>> different from FB's OPEN. This is documented.
>>
>> 2) FBtoC supports only an FSSpec or FSRef with the OPEN verb.
>> Again, please see the FBtoC docs.
>>
>> FSSpecs were implemented in FBtoC  so existing code wouldn't break
>> (assuming someone was using the most modern FB offered ---
>> FSSpecs) . It would have been much easier in FBtoC to use only FSRefs
>>
>> If you are not using FSSpecs, consider going directly to FSRefs
>> instead. FSSpecs do NOT handle long ( > 31 chars) files names and
>> your users will call/email asking why their file names have garbage
>> in them. Some users won't notice the file name but mangled file
>> names can cause other issues including (under the right conditions)
>> inadvertent data loss. Apple deprecated FSSpecs for good reasons
>> and it wasn't just some whimsical choice to annoy programmers.
>>
>> Brian S.
>>
>> --
>> To unsubscribe, send ANY message to: futurebasic-
>> unsubscribe@...
>>
>
>