Changeset 15012 in project


Ignore:
Timestamp:
06/18/09 03:23:12 (10 years ago)
Author:
Jim Ursetto
Message:

hfs+: update to version 0.2

Location:
release/4/hfs+/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/hfs+/trunk/hfs+.scm

    r14881 r15012  
    2020  get-extended-attribute set-extended-attribute!
    2121  remove-extended-attribute!
    22   get-extended-attributes)
     22  get-extended-attributes
     23  clear-extended-attributes!)
    2324
    2425(import scheme chicken foreign)
     
    5455(define removexattr
    5556  (foreign-lambda int removexattr (const c-string) (const c-string) int))
     57(define fremovexattr
     58  (foreign-lambda int fremovexattr int (const c-string) int))
    5659
    5760(define-foreign-enum-type (xattr-options int)
     
    5962  ((no-follow xattr/nofollow) XATTR_NOFOLLOW)
    6063  ((create xattr/create) XATTR_CREATE)
    61   ((replace xattr/replace) XATTR_REPLACE))
     64  ((replace xattr/replace) XATTR_REPLACE)
     65  ((silent xattr/silent) "0")  ; hack -- not a real API option :)
     66  )
    6267
    6368(define strerror
     
    143148                        buf)))))))))
    144149
     150;; #:silent could, possibly, fail silently on errno/noattr or errno/exist.
    145151(define (set-extended-attribute! file attribute value . options)
    146152  (let ((c-options (xattr-options->int options))  ; 'create + 'replace results in EINVAL
     
    174180               (void)))))))
    175181
    176 ;; Error signaled if attribute does not exist.  Unsure about this.
     182;; Error signaled if attribute does not exist, but if you give the
     183;; #:silent option it will fail silently.
    177184(define (remove-extended-attribute! file attribute . options)
    178   (let ((c-options (xattr-options->int options)))
     185  (let ((c-options (xattr-options->int options))
     186        (attribute (if (symbol? attribute)
     187                       (symbol->string attribute)
     188                       attribute))
     189        (removexattr (if (number? file)
     190                         fremovexattr
     191                         removexattr)))
    179192    (let ((rv (removexattr file attribute c-options)))
    180193      (cond ((< rv 0)
    181194             (let ((err (update-errno)))
    182                (xattr-error err 'remove-extended-attribute! file attribute)))
     195               (if (and (= err errno/noattr)
     196                        (memq #:silent options))
     197                   (void)
     198                   (xattr-error err 'remove-extended-attribute! file attribute))))
     199            ((> rv 0)
     200             (error 'remove-extended-attribute!
     201                    "unexpected return value" rv))
    183202            (else
    184203             (void))))))
     
    195214       (apply list-extended-attributes file options)))
    196215
     216(define (clear-extended-attributes! file . options)
     217  (for-each
     218   (lambda (x)
     219     (apply remove-extended-attribute! file x options))
     220   (apply list-extended-attributes file options)))
     221
    197222;; (define (get-resource-fork filename)
    198223;;   ...)
  • release/4/hfs+/trunk/hfs+.setup

    r14881 r15012  
    44 'foreigners
    55 '("hfs+.so" "hfs+.import.so")
    6  '((version 0.1)))
     6 '((version 0.2)))
Note: See TracChangeset for help on using the changeset viewer.