| Arc lacks many basic filesystem functions (mtime, mkdir, size, etc.) and it seems the only way to add them is via scheme. Without further ado: (xdef 'file-mv (lambda (src dst)
(rename-file-or-directory src dst)
'nil))
(xdef 'file-cp (lambda (src dst)
(copy-file src dst)
'nil))
(xdef 'file-mtime (lambda (path)
(file-or-directory-modify-seconds path)))
(xdef 'file-perms (lambda (path)
(file-or-directory-permissions path)))
(xdef 'file-size (lambda (path)
(file-size path)))
(xdef 'pwd (lambda () (path->string (current-directory))))
(xdef 'mkdir (lambda (path)
(make-directory path)
'nil))
;; there's no reason this couldn't be defined in arc, but better to
;; keep all these defs together (as such, take advantage of scheme)
(xdef 'file-join (lambda (first . rest)
(path->string (apply build-path (cons first rest)))))
Throw that somewhere appropriate in ac.scm. I'm aware that these probably aren't all named perfectly. I think I prefer mtime to file-mtime, and mv and cp are probably better than file-mv and file-cp. Bike-shedding.... |