[Openmcl-devel] delete-file and directories

Gary Byers gb at clozure.com
Mon Mar 14 18:29:09 PST 2005



On Mon, 14 Mar 2005, George Khouri wrote:

>
> >
> >
> >On Mon, 14 Mar 2005, George Khouri wrote:
> >
> >>  COPY-FILE: On OSX, should COPY-FILE call "CpMac" or something
> >> similar, instead of "cp?"  I'm guessing most of us using OSX still
> >> have files with resource forks, and will likely have them for a
> >> while. How do we detect and copy resource forks in OpenMCL, without
> >> making an objc call?
> >
> >It's a little strange, but the Darwin layer allows the resource fork
> >of a file named FOO to be referenced via the name FOO/rsrc.
> >
> >If you wanted to copy FOO to BAR (and preserve the resource fork), you
> >can do it in two steps:
> >
> >;;; It seems to be necessary to create the output file before
> >;;; trying to write to its resource fork
> >(copy-file "FOO" "BAR")
> >(copy-file "FOO/rsrc" "BAR/rsrc" :if-exists :overwrite)
> >

> What's ugly is that a program would have to check for the existence
> of a resource fork and make two calls to copy-file (though some code
> at some level has to check for and handle two forks anyway). That's
> not the end of the world for the occasional copy operation, but for
> copying a large number of files (e.g., one file system to another),
> it's not very pretty or necessarily efficient.  It seems to me that
> COPY-FILE should shield the programmer from that detail anyway,
> especially for some semblance of portability. COPY-FILE in it's
> current state is unreliable, since it will silently fail to copy a
> dual-fork file on MacOS, rendering the target file unusable in most
> cases. One could write a COPY-ANY-MACOS-FILE function, but I think
> what's important is that COPY-FILE's functionality is conditional on
> MacOS, in that it doesn't always do what it's advertised to do ...

I don't know; resource forks are a deprecated feature of OSX (they've
been deprecated - to some degree - since OS 8.6 or so.)  I can only
think of one (fairly obvious example of a) development system that
creates and depends on resources stored in resource forks, and can
think of many examples - including OpenMCL - of OSX programs that are
(mostly or entirely) blissfully unaware of resource forks.

It doesn't follow - to me, at least - that those other OSX programs
(including OpenMCL) "should" provide much support for files generated
by legacy programs that use deprecated OS features; even though it
seems ugly and awkward, appending "/rsrc" to a namestring in order
to access a file's resource fork seems to me to be about the right
level of support.





More information about the Openmcl-devel mailing list