Re: Deleting resource forks
Re: Deleting resource forks
- Subject: Re: Deleting resource forks
- From: Philip Aker <email@hidden>
- Date: Thu, 11 Jul 2002 22:33:19 -0700
On Thursday, July 11, 2002, at 09:46 AM, garbanzito wrote:
It's possible to delete a specific fork. There is a legit call
in Files.h:
EXTERN_API( OSErr )
FSDeleteFork( const FSRef *ref, UniCharCount forkNameLength,
const UniChar *forkName );
the name is deceptive. the docs for FSDeleteFork state:
"Any storage allocated to the fork is released. If a given fork
always exists for a given volume format (such as data and
resource forks for HFS and HFS Plus, or data forks for most
other volume formats), this is equivalent to setting the
logical size of the fork to zero."
Well, I assumed I was wrong and had stuck my foot in my mouth.
But I checked on the Carbon list and received several replies.
The reply from Larry Harris (File Buddy programmer) which said:
"FSDeleteFork() does delete the whole resource fork if you pass
it the name of the resource fork (at least it does for me). But
you can also set the logical length of the fork to 0."
Then I checked it out for myself on a file which had a resource
fork with the following code in a Carbon application:
OSStatus err = noErr;
HFSUniStr255 fork;
FSRef ref;
char *path = "disk:folder:file";
err = FSPathMakeRef( (UInt8 *)path, &ref, NULL );
err = FSGetResourceForkName( &fork );
err = FSDeleteFork( &ref, fork.length, fork.unicode );
After execution, the file had no resource fork because when I
tried to open it with ResEdit, I was asked if I wanted to create
one.
So what exactly do you mean when you say: "the name is deceptive"?
Philip Aker
p h i l i p @ v c n . b c . c a
h t t p : / / w w w . a k e r . c a /
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.