|
@@ -30,9 +30,17 @@ BODY on files that match the given extension."
|
30
|
30
|
#',extension-p
|
31
|
31
|
(constantly t))))))
|
32
|
32
|
|
|
33
|
+(define-condition directory-does-not-exist (error)
|
|
34
|
+ ((directory :initarg dir :reader dir))
|
|
35
|
+ (:report (lambda (c stream)
|
|
36
|
+ (format stream "The directory '~A' does not exist" (dir c)))))
|
|
37
|
+
|
33
|
38
|
(defun (setf getcwd) (path)
|
34
|
39
|
"Change the operating system's current directory to PATH."
|
35
|
|
- (chdir path)
|
|
40
|
+ (setf path (ensure-directory-pathname path))
|
|
41
|
+ (or (and (directory-exists-p path)
|
|
42
|
+ (chdir path))
|
|
43
|
+ (error 'directory-does-not-exist :dir path))
|
36
|
44
|
path)
|
37
|
45
|
|
38
|
46
|
(defmacro with-current-directory (path &body body)
|