views:

315

answers:

2

Hello,

I'm working on an application that syncs data. For Mac OS, files are uploaded and if they contain resource fork information, the fork is read and stored as a string using: file/..namedfork/rsrc

Users can access their files using a Web application(Java) that's running on a Linux server, is there a way that I can generate a valid AppleDouble format file using only the data fork and the string I read from the namedfork? I don't mind losing the Finder Metadata.

Note: The generated file will be downloaded (using the Web Application) as a single file for Mac OS users.

Is this possible?

Regards

A: 

The wikipedia article states:

AppleSingle combined both file forks and the related Finder meta-file information into a single file, whereas AppleDouble stored them as two separate files.

The apple knowledgebase atricle states:

The second new file has the name of the original file prefixed by a "._ " and contains the resource fork of the original file.

So I assume you just have to save the content of your resource fork string into the appropriately named file.

Edit: After your comment I'm not sure what you want. Your question was how to

Create AppleDouble formatted file in Linux

and the documentation I linked to shows that you need to create two files to do that one containing the data and one containing the resource fork with a name that has ._ prefixed. If that is not what you want then you need to ask a different question.

lothar
Hello, Resource forks are a part of the HFS filesystem on the mac, it's only when those files are moved outside of HFS+ that they get split into file.txt and ._file.txt. On a mac, they both exist under the same file.txt name.The other problem is that I want users to be able to download the file from the web, as a single file. You can check the appledouble spec here: users.phg-online.de/tk/netatalk/doc/Apple/v2/AppleSingle_AppleDouble.pdf
You lost me. In your question you stated that in your application you already extracted the resource into a string. In that case it should be easy for you to create the AppleDouble format on Linux, as you only need to store the resource data as a file with ._ prefixed.
lothar
Yes I do have the resource. My point is that even though I'm creating the AppleDouble in linux, I want the user (which is using a mac) to be able to download one single file that already has the resource fork as they would normally see in the Finder application.
Well then you should have asked that as your question, because the question you have asked is different. You can either rephrase your question or ask a different one.
lothar
I wouldn't say my question is different, I want to create an AppleDouble file in linux, and I did mentioned that users were going to access their file using a Web Application. Maybe I didn't explain myself properly, I'll add an extra note at the end of my question. Thanks anyway
A: 

As far as I'm aware, OS 9/OS X can only natively access the resource forks on files served by AppleTalk shares. For other media, e.g. SMB (Microsoft Networking) or HTTP, the only way to preserve the resource fork is to place the file in an archive.

There are several Mac-specific archive formats that support this, for example, StuffIt and HQX. I very much doubt the Linux binaries for StuffIt would allow packaging a resource fork from a separate file, but at least there is something for you to evaluate.

Looking at the AppleDouble Wikipedia entry, it seems it may be possible to create such a file from a non-Apple machine using an open source tool, and sending the resultant file using the multipart/appledouble MIME type. Perhaps you could call this binary from your Java code?

David Wilson