Writing to the resource fork

Joe Lewis Wilkins pepetoo at cox.net
Fri May 28 18:32:06 EDT 2010


I thought we stopped using the Resource fork quite some time ago in favor of external files.

Joe Lewis Wilkins




On May 28, 2010, at 3:24 PM, Joe F. wrote:

> Your example worked for me on OS X 10.6.3 when I made these changes.
> 
>   put empty into URL "binfile:~/desktop/resource test.dat"
>   get setResource("~/desktop/resource test.dat","TEXT",999,"Test","U","Hello World")
> 
> 
> On May 27, 2010, at 6:25 PM, Mark Schonewille wrote:
> 
>> Hi,
>> 
>> For a new project, it is essential that I can read from and write to the resource fork of a file. I am not looking for a way to copy resource forks.
>> 
>> I am trying to use the setResource function, but it doesn't work. I tried it with Rev 4.0 on Mac OS X 10.5 and Rev 2.6.1 on Mac OS 9.2.2. With both systems, I get the same result: the resource is created (including ID, name and flags, but the data are not written to it.
>> 
>> On Mac OS X, contrary to what the documentation claims, the file isn't created automatically, if the file doesn't exist yet. Therefore, I create the file before writing the resource fork.
>> 
>> Does anyone have a clue about what might be wrong with the following two lines?
>> 
>> put empty into url "binfile:~/desktop/resource test.dat"
>> get setresource("/Users/Mark/desktop/resource test.dat","MARK",999,"Test","U","Hello World")
>> 
>> Althought the serResource function doesn't work correctly for me, the getResource and getResources functions work fine on both systems.
>> 
>> I tried to find a solution in the archives, but it looks like this function is rarely used. I need it though.
>> 
>> --
>> Best regards,
>> 
>> Mark Schonewille
>> 
>> Economy-x-Talk Consulting and Software Engineering
>> Homepage: http://economy-x-talk.com
>> Twitter: http://twitter.com/xtalkprogrammer
>> 
>> Economy-x-Talk is always looking for new projects. Contact me for a quote http://economy-x-talk.com/contact.html
>> Download Clipboard Link http://clipboardlink.economy-x-talk.com and share the clipboard of your computer over the local network.
>> 



More information about the use-livecode mailing list