I would be inclined to go with something like this:
(defun delete-file (file)
#!+sb-doc
"Delete the specified FILE.
If FILE is a stream, on Windows the stream is closed immediately. On Unix
plaforms the stream remains open, allowing IO to continue: the resources
associated with the deleted file remain available till the stream is closed as
per standard Unix unlink() behaviour."
(let* ((truename (truename file)) (namestring (native-namestring truename :as-file t)))
#!+win32
(when (streamp file)
(close file))
(multiple-value-bind (res err) (sb!unix:unix-unlink namestring)
(unless res (simple-file-perror "couldn't delete ~A" namestring err))))
t)
I would be inclined to go with something like this:
(defun delete-file (file)
#!+sb-doc
"Delete the specified FILE.
If FILE is a stream, on Windows the stream is closed immediately. On Unix
(namestring (native-namestring truename :as-file t))) value-bind (res err) (sb!unix: unix-unlink namestring)
(simple- file-perror "couldn't delete ~A" namestring err))))
plaforms the stream remains open, allowing IO to continue: the resources
associated with the deleted file remain available till the stream is closed as
per standard Unix unlink() behaviour."
(let* ((truename (truename file))
#!+win32
(when (streamp file)
(close file))
(multiple-
(unless res
t)