(index ("list-extended-attributes" 0) ("get-extended-attribute" 343) ("set-extended-attribute!" 677) ("remove-extended-attribute!" 1510) ("copyfile" 2109) ("get-extended-attributes" 3371) ("clear-extended-attributes!" 3743) ("copyfile-check" 3904) ("pack-appledouble" 4967) ("unpack-appledouble" 5580))
(def (sig (procedure "(list-extended-attributes file . options)" (id list-extended-attributes))) (p "List extended attribute names of " (tt "FILE") ".") (p "Returns a list containing one string per attribute name.") (pre " (list-extended-attributes \"examples.scm\" #:no-follow)\n ; => (\"com.apple.FinderInfo\" \"com.apple.ResourceFork\")"))
(def (sig (procedure "(get-extended-attribute file attribute . options)" (id get-extended-attribute))) (p "Get the value of extended attribute " (tt "ATTRIBUTE") " from " (tt "FILE") ".") (p "Returns a string representing the value.  The string may contain binary data.") (p "Returns " (tt "#f") " if the attribute does not exist."))
(def (sig (procedure "(set-extended-attribute! file attribute value . options)" (id set-extended-attribute!))) (p "Set extended attribute " (tt "ATTRIBUTE") " on " (tt "FILE") " to " (tt "VALUE") ", and return an unspecified value.") (p (tt "VALUE") " may be a string or a blob.") (p "In addition to " (tt "#:no-follow") ", " (tt "set-extended-attribute!") " allows the following two mutually-exclusive options:") ((table "\n" (tr (td "#:create") (td "Raise error if attribute exists.")) "\n" (tr (td "#:replace") (td "Raise error if attribute does not exist.")) "\n")) (p "If neither option is specified, existing attribute values are silently overwritten.") (pre "(set-extended-attribute! \"examples.scm\" 'org.callcc \"courtesy of Chicken\")\n(get-extended-attribute \"examples.scm\" 'org.callcc)\n; => \"courtesy of Chicken\""))
(def (sig (procedure "(remove-extended-attribute! file attribute . options)" (id remove-extended-attribute!))) (p "Remove extended attribute " (tt "ATTRIBUTE") " from " (tt "FILE") ".  By default, if " (tt "ATTRIBUTE") " does not exist, an error is signaled.") (p (tt "remove-extended-attribute!") " also accepts the following options:") ((table "\n" (tr (td "#:silent") (td "Do not raise an error if the attribute is missing.")) "\n")) (p "The #:silent option is useful if, for example, you wish to truncate a resource fork but are not sure if one is already present.  See below for an example."))
(def (sig (procedure "(copyfile from to . options)" (id copyfile))) (p "Copies " (tt "FROM") " file to " (tt "TO") " file using the OS X " (tt "copyfile(3)") " API, preserving HFS+ metadata as specified in copyfile " (tt "OPTIONS") ". Always returns a true value, indicating success; failure will raise an error.  In the current implementation, both " (tt "FROM") " and " (tt "TO") " must be filenames; ports are not accepted.") (p "If the " (tt "#:check") " option is given, " (tt "copyfile") " will determine which metadata would be copied from the source, without copying it.  It returns zero if there is no corresponding metadata, and a positive value if there is metadata to copy.  Either way, the return value is true, indicating success.") (p "If " (tt "#:pack") " is given, " (tt "copyfile") " serializes the desired metadata to an AppleDouble file named by the " (tt "TO") " argument.  " (tt "#:unpack") " is the opposite of " (tt "#:pack") ".  This AppleDouble file is the same format as that produced when writing a file to a non-HFS+ filesystem, such as across a network to NFS or Samba.  Because an AppleDouble file is always created when packing, even if there is no metadata to copy, you may wish to use " (tt "#:check") " first to avoid this."))
(def (sig (procedure "(get-extended-attributes file . options)" (id get-extended-attributes))) (p "Returns an alist mapping attribute names (symbols) to values (strings).") (pre "(get-extended-attributes \"examples.scm\")\n;=> ((com.apple.FinderInfo . \"TEXTEMAx\")\n     (com.apple.ResourceFork . \"courtesy of Chicken\")\n     (org.callcc . \"courtesy of Chicken\"))"))
(def (sig (procedure "(clear-extended-attributes! file . options)" (id clear-extended-attributes!))) (p "Remove all extended attributes from " (tt "FILE") "."))
(def (sig (procedure "(copyfile-check from . options)" (id copyfile-check))) (p "Determines if any metadata is present in " (tt "FROM") " using the " (tt "#:check") " option to " (tt "copyfile") ".  Returns a list of symbols denoting metadata types that are present, from the following possibilities:") ((table "\n" (tr (td "acls") (td "COPYFILE_ACL") (td "ACLs")) "\n" (tr (td "stat") (td "COPYFILE_STAT") (td "POSIX stat(2) data")) "\n" (tr (td "extended-attributes") (td "COPYFILE_XATTR") (td "Extended attributes")) "\n")) (p "Note: another way to check merely for the presence of metadata is to use the " (tt "#:check") " option to copyfile.  A positive value means present, a zero value means not present.") (p "Example:") (pre "#;> (copyfile-check \"foo.txt\" #:metadata)\n(acls stat extended-attributes)\n#;> (copyfile-check \"foo.txt\" #:extended-attributes)\n(extended-attributes)\n#;> (copyfile-check \"bar.txt\" #:metadata)\n()\n#;> (> (copyfile \"foo.txt\" #f #:check #:metadata) 0)\n#t\n#;> (> (copyfile \"bar.txt\" #f #:check #:metadata) 0)\n#f"))
(def (sig (procedure "(pack-appledouble from to . options)" (id pack-appledouble))) (p "Serialize all HFS+ metadata (extended attributes, ACLs, stat(2) data) in " (tt "FROM") " to AppleDouble file " (tt "TO") ".  Returns false when no metadata was present (and does not write a file) or true if metadata was present (and a file is written).  May also throw a file error.") (p "Extra options are passed into " (tt "copyfile") "; relevant ones might be " (tt "#:exclusive") ", " (tt "#:move") " and " (tt "#:no-follow") ", although " (tt "#:move") " and " (tt "#:no-follow") " do not work correctly under Tiger."))
(def (sig (procedure "(unpack-appledouble from to . options)" (id unpack-appledouble))) (p "Unserialize all HFS+ metadata in AppleDouble file " (tt "FROM") " to " (tt "TO") ". Always returns true, or throws an error on I/O error."))
