Changeset 15012 in project
- Timestamp:
- 06/18/09 03:23:12 (12 years ago)
- Location:
- release/4/hfs+/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
release/4/hfs+/trunk/hfs+.scm
r14881 r15012 20 20 get-extended-attribute set-extended-attribute! 21 21 remove-extended-attribute! 22 get-extended-attributes) 22 get-extended-attributes 23 clear-extended-attributes!) 23 24 24 25 (import scheme chicken foreign) … … 54 55 (define removexattr 55 56 (foreign-lambda int removexattr (const c-string) (const c-string) int)) 57 (define fremovexattr 58 (foreign-lambda int fremovexattr int (const c-string) int)) 56 59 57 60 (define-foreign-enum-type (xattr-options int) … … 59 62 ((no-follow xattr/nofollow) XATTR_NOFOLLOW) 60 63 ((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 ) 62 67 63 68 (define strerror … … 143 148 buf))))))))) 144 149 150 ;; #:silent could, possibly, fail silently on errno/noattr or errno/exist. 145 151 (define (set-extended-attribute! file attribute value . options) 146 152 (let ((c-options (xattr-options->int options)) ; 'create + 'replace results in EINVAL … … 174 180 (void))))))) 175 181 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. 177 184 (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))) 179 192 (let ((rv (removexattr file attribute c-options))) 180 193 (cond ((< rv 0) 181 194 (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)) 183 202 (else 184 203 (void)))))) … … 195 214 (apply list-extended-attributes file options))) 196 215 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 197 222 ;; (define (get-resource-fork filename) 198 223 ;; ...) -
release/4/hfs+/trunk/hfs+.setup
r14881 r15012 4 4 'foreigners 5 5 '("hfs+.so" "hfs+.import.so") 6 '((version 0. 1)))6 '((version 0.2)))
Note: See TracChangeset
for help on using the changeset viewer.