added file-exists? and delete-file operations to libposix.ss and ikarus-runtime.c

This commit is contained in:
Abdulaziz Ghuloum
2006-11-29 17:06:16 -05:00
parent e97b39a39a
commit 9eaaf3c438
7 changed files with 184 additions and 27 deletions
BIN
View File
Binary file not shown.
Binary file not shown.
+45
View File
@@ -21,3 +21,48 @@
(error 'system "failed")
rv))))
(primitive-set! 'file-exists?
(lambda (x)
(unless (string? x)
(error 'file-exists? "filename ~s is not a string" x))
(let ([v (foreign-call "ikrt_file_exists" x)])
(cond
[(boolean? v) v]
[else
(error 'file-exists?
(case v
[(1) "the path ~s contains a non-directory"]
[(2) "the path ~s is too long"]
[(3) "the path ~s is not accessible"]
[(4) "the path ~s contains too many symbolic links"]
[(5) "internal access error while accessing ~s"]
[(6) "IO error encountered while accessing ~s"]
[else "Unknown error in ~s"])
x)]))))
(primitive-set! 'delete-file
(lambda (x)
(unless (string? x)
(error 'delete-file "filename ~s is not a string" x))
(let ([v (foreign-call "ikrt_delete_file" x)])
(case v
[(0) (void)]
[else
(error 'delete-file
(case v
[(1) "the path ~s contains a non-directory"]
[(2) "the path ~s is too long"]
[(3) "the file ~s does not exist"]
[(4) "the path ~s is not accessible"]
[(5) "the path ~s contains too many symbolic links"]
[(6) "you do not have permissions to delete ~s"]
[(7) "device ~s is busy"]
[(8) "IO error encountered while deleting ~s"]
[(9) "~s is in a read-only file system"]
[(10) "internal access error while deleting ~s"]
[else "Unknown error while deleting ~s"])
x)]))))
+1
View File
@@ -108,6 +108,7 @@
with-output-to-file call-with-output-file
with-input-from-file call-with-input-file
date-string
file-exists? delete-file
+ - add1 sub1 * expt number? positive? negative? zero? number->string
logand