From: do (Don Cohen)

Subject: Writeprotected devices

Date: 1997-6-3 13:10

  
  Since we start our application from CD, most of our default folders are set
  on the CD device. Now we have the problem to determine wether or not we can
  write on a device in order to make sure not to get an error during the
  attempt to save a file on the default folders.
  
  Does anyone has some experiences with this problem?  Is there a portable
  solution (MCL) ?

I don't know of any way to tell without trying to write.

Here's what I use:

(defun FILE-WRITABLE-P (file)
  (if (probe-file file)
      (ignore-errors
       (with-open-file (s file :direction :output
                        :if-does-not-exist :error
                        ;; append: don't empty it if writable
                        :if-exists :append)
         t))
      (ignore-errors
       (with-open-file (s file :direction :output
                        :if-does-not-exist :create))
       (delete-file file)
       t)))