/[meta-cvs]/meta-cvs/F-6BD7679FED76D6E5A7D36DC36C205FC1.lisp
ViewVC logotype

Diff of /meta-cvs/F-6BD7679FED76D6E5A7D36DC36C205FC1.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by kaz, Sat Aug 17 19:26:26 2002 UTC revision 1.4.2.2 by kaz, Sun Aug 25 16:07:05 2002 UTC
# Line 220  Line 220 
220    
221  (define-condition link-error (system-error)  (define-condition link-error (system-error)
222    ((from-path :initarg :from-path)    ((from-path :initarg :from-path)
223     (to-path :initarg :to-path)))     (to-path :initarg :to-path)
224       (kind :initarg :kind)))
225    
226  (defmethod initialize-instance :after ((c link-error) &rest args)  (defmethod initialize-instance :after ((c link-error) &rest args)
227    (declare (ignore args))    (declare (ignore args))
228    (with-slots (message from-path to-path) c    (with-slots (message kind from-path to-path) c
229      (setf message (format nil "Unable to link ~A to ~A: ~A."      (setf message (format nil "Unable to make ~A link from ~A to ~A: ~A."
230                            from-path to-path                            kind from-path to-path
231                            (unix-funcs:strerror unix-funcs:errno)))))                            (unix-funcs:strerror unix-funcs:errno)))))
232    
233  (defun link (from to)  (defun link (from to)
234    (if (zerop (unix-funcs:link from to))    (if (zerop (unix-funcs:link from to))
235      (values)      (values)
236      (error (make-condition 'link-error :from-path from :to-path to))))      (error (make-condition 'link-error :from-path from
237                               :to-path to :kind "hard"))))
238    
239    (defun symlink (from to)
240      (if (zerop (unix-funcs:symlink from to))
241        (values)
242        (error (make-condition 'link-error :from-path from
243                               :to-path to :kind "symbolic"))))
244    
245    (define-condition readlink-error (system-error)
246      ((path :initarg :path)))
247    
248    (defmethod initialize-instance :after ((c readlink-error) &rest args)
249      (declare (ignore args))
250      (with-slots (message path) c
251        (setf message (format nil "Unable to read symbolic link ~A: ~A."
252                              path (unix-funcs:strerror unix-funcs:errno)))))
253    
254    (defun readlink (path)
255      (let ((data (unix-funcs:readlink path)))
256        (if data
257          data
258          (error (make-condition 'readlink-error :path path)))))
259    
260  ;;; Directory removal  ;;; Directory removal
261    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.4.2.2

  ViewVC Help
Powered by ViewVC 1.1.5