/lib/files.arc
Unknown | 42 lines | 34 code | 8 blank | 0 comment | 0 complexity | 1be2edb2bc19b09dbe013bc29d235126 MD5 | raw file
1(def mv (src dst) 2 " Moves the file or directory `src' to `dst'. " 3 ($.rename-file-or-directory src dst) 4 nil) 5 6(def cp (src dst) 7 " Copies the file `src' to `dst'. " 8 ($.copy-file src dst) 9 nil) 10 11(def mtime (path) 12 " Returns the modification time of the file or directory `path' in 13 seconds since the epoch. " 14 ($.file-or-directory-modify-seconds path)) 15 16(def file-perms (path) 17 " Returns a list of the effective file permssions of `path'. " 18 ($.file-or-directory-permissions path)) 19 20(def file-size (path) 21 " Returns the size, in bytes, of a file `path'. " 22 ($.file-size path)) 23 24(def cd (path) 25 " Changes the current directory. " 26 ($.current-directory path) 27 (pwd)) 28 29(def pwd () 30 " Returns the current directory. " 31 ($ (path->string (current-directory)))) 32 33; This could be defined in pure Arc, but we don't really have a good way of 34; testing whether or not we should use Windows path separators, 35; so we'll leave it up to Scheme. 36(def file-join parts 37 " Joins `parts' into a path string. " 38 ($.path->string (apply $.build-path parts))) 39 40(def qualified-path (path) 41 " Returns the fully-qualified path of a possibly relative `path'. " 42 ($ (path->string (simplify-path (path->complete-path ,path)))))