123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- (library (file-system)
- (export file?
- directory?
- readable?
- readable-file?
- readable-directory?
- file-size-in-bytes)
- (import (rnrs base)
- (only (guile)
- lambda* λ
- stat
- stat:type
- stat:size
- access?
- file-exists?
- R_OK))
- (define file?
- (λ (path)
- (and (file-exists? path)
- (eq? (stat:type (stat path)) 'regular))))
- (define directory?
- (λ (path)
- (and (file-exists? path)
- (eq? (stat:type (stat path)) 'directory))))
- (define readable?
- (λ (path)
- (access? path R_OK)))
- (define readable-file?
- (λ (path)
- (and (readable? path)
- (file? path))))
- (define readable-directory?
- (λ (path)
- (and (readable? path)
- (directory? path))))
- (define file-size-in-bytes
- (λ (path)
- (stat:size (stat path)))))
|