407 |
(if (provided? 'socket) |
(if (provided? 'socket) |
408 |
(primitive-load-path "ice-9/networking.scm")) |
(primitive-load-path "ice-9/networking.scm")) |
409 |
|
|
410 |
|
;; ENHANCE-ME: Catching an exception from stat is a bit wasteful, do this in |
411 |
|
;; C where all that's needed is to inspect the return from stat(). |
412 |
(define file-exists? |
(define file-exists? |
413 |
(if (provided? 'posix) |
(if (provided? 'posix) |
414 |
(lambda (str) |
(lambda (str) |
415 |
(access? str F_OK)) |
(->bool (false-if-exception (stat str)))) |
416 |
(lambda (str) |
(lambda (str) |
417 |
(let ((port (catch 'system-error (lambda () (open-file str OPEN_READ)) |
(let ((port (catch 'system-error (lambda () (open-file str OPEN_READ)) |
418 |
(lambda args #f)))) |
(lambda args #f)))) |