* file-exists? now uses bytevectors for filenames.

This commit is contained in:
Abdulaziz Ghuloum 2007-05-18 22:18:51 -04:00
parent b54cc9a762
commit cc500489b7
4 changed files with 9 additions and 2 deletions

Binary file not shown.

View File

@ -575,7 +575,13 @@ ERRORS
*/
ikp
ikrt_file_exists(ikp filename){
char* str = string_data(filename);
char* str;
if(tagof(filename) == bytevector_tag){
str = (char*)filename + off_bytevector_data;
} else {
fprintf(stderr, "bug in ikrt_file_exists\n");
exit(-1);
}
struct stat sb;
int st = stat(str, &sb);
if(st == 0){

Binary file not shown.

View File

@ -40,7 +40,8 @@
(lambda (x)
(unless (string? x)
(error 'file-exists? "filename ~s is not a string" x))
(let ([v (foreign-call "ikrt_file_exists" x)])
(let ([v (foreign-call "ikrt_file_exists"
(string->utf8-bytevector x))])
(cond
[(boolean? v) v]
[else