Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Resource fork help



Thanks so much for your help, Greg.

It looks like I am going to need to also install some native code, then.  Preferably, I would like to have a small tool which creates an AppleDouble file given any other file.

So for example,

createappledouble foo.png

would automatically create ._foo.png.

Does anyone know of any programs like this that already exist?  I would much rather do this than try and cheat by copying files into disk images just to get at the AppleDouble file.  Creating a zip archive of the data-fork along with the AppleDouble file would also be ok, but I don't think it is possible with the command-line zip tool.

Does anyone have any ideas?  If no programs exist to do this, are there API calls available that I can use to write my own program?

Thanks again,
Sebastian


-----Original Message-----
From: java-dev-bounces+sebastian.celis=email@hidden
[mailto:java-dev-bounces+sebastian.celis=email@hidden]On
Behalf Of Greg Guerin
Sent: Tuesday, December 19, 2006 5:20 PM
To: email@hidden
Subject: Re: Resource fork help


Geoff Levner wrote:

>We use the Mac commands Rez and DeRez to do this: DeRez to "decompile" the
>resource fork into a normal file, Rez to combine the data and resource
>forks back into a Mac file.  Both are installed with the developer tools,
>though, in the /Developer/Tools folder, so you can't count on them being on
>all users' machines.

If you're not also using GetFileInfo and SetFile, you're losing
file-creator, file-type, and Finder flags.  These are critical for
alias-files, because without the right values, aliases lose their aliasness.

GetFileInfo and SetFile are also only installed with Developer Tools, so if
you can get away with DeRez/Rez, you can be fairly certain of getting away
with GetFileInfo/SetFile.

Convincing non-developers to first download and install all of Developer
Tools just to get those commands is a slightly more difficult option than
installing a JNI library.


Frankly, you could just as easily gzip or tar the data-fork and
named-resource-fork without using Rez/DeRez at all.  AFAIK, there's still
no solution for preserving metadata, though.

Named resource forks work on ppc or i386, so I don't see how DeRez/Rez is
really giving you anything you can't already get another way, and without
needing Developer Tools installed.  For example, the 'ls' command is
ignorant of resource forks, and so is 'md5', but this will show sizes and
hashes of any resource-forks of any file that has them:
  ls -l */rsrc
  md5 */rsrc

These examples use the older easier-to-type notation of "/rsrc" suffixed to
an ordinary file's pathname.  That works in Java, too, as does the
..namedfork/rsrc notation (try it on a FileInputStream).


One possible option may be to script the Finder to produce a zip-archive of
the desired file.  This should include all the metadata and resource fork
contents, assuming the Finder can be told to do that.

  -- GG


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden

References: 
 >Re: Resource fork help (From: Greg Guerin <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.