Members directory reading.
This commit is contained in:
parent
8803c11f5e
commit
83b27f4de4
2 changed files with 30 additions and 3 deletions
|
@ -34,9 +34,35 @@
|
|||
|
||||
(import scheme
|
||||
(chicken base)
|
||||
testing)
|
||||
(chicken pathname)
|
||||
(chicken file posix)
|
||||
(chicken file)
|
||||
testing
|
||||
dictionary)
|
||||
|
||||
(define (load-members)
|
||||
;; Gets all files and symbolic links from given directory. The
|
||||
;; symbolic links are represented by cons cells with car being the
|
||||
;; name and cdr the link target.
|
||||
(define (get-files+symlinks dn)
|
||||
(let loop ((fns (directory dn))
|
||||
(rs '()))
|
||||
(if (null? fns)
|
||||
rs
|
||||
(let* ((fn (car fns))
|
||||
(ffn (make-pathname dn fn)))
|
||||
(loop (cdr fns)
|
||||
(if (symbolic-link? ffn)
|
||||
(cons (cons fn (read-symbolic-link ffn)) rs)
|
||||
(if (regular-file? ffn)
|
||||
(cons fn rs)
|
||||
rs)))))))
|
||||
|
||||
(define (load-members dn)
|
||||
;; get the directory contents
|
||||
(print (get-files+symlinks dn))
|
||||
;; filter all ids
|
||||
;; resolve links (it might be unknown!)
|
||||
;; load member files
|
||||
1)
|
||||
|
||||
(define (members-base-tests!)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue