PS: I'm an idiot.
This commit is contained in:
parent
394d3d3bb8
commit
43d439657a
1 changed files with 8 additions and 8 deletions
|
@ -36,19 +36,19 @@ on files that match the given extension."
|
||||||
|
|
||||||
(defun (setf current-directory) (path)
|
(defun (setf current-directory) (path)
|
||||||
"Change the operating system's current directory to PATH."
|
"Change the operating system's current directory to PATH."
|
||||||
#+sbcl (sb-posix:chdir pathspec)
|
#+sbcl (sb-posix:chdir path)
|
||||||
#+ccl (setf (current-directory) pathspec)
|
#+ccl (setf (current-directory) path)
|
||||||
#+ecl (si:chdir pathspec)
|
#+ecl (si:chdir path)
|
||||||
#+cmucl (unix:unix-chdir (namestring pathspec))
|
#+cmucl (unix:unix-chdir (namestring path))
|
||||||
#+clisp (ext:cd pathspec)
|
#+clisp (ext:cd path)
|
||||||
#-(or sbcl ccl ecl cmucl clisp) (error "Not implemented yet."))
|
#-(or sbcl ccl ecl cmucl clisp) (error "Not implemented yet."))
|
||||||
|
|
||||||
(defmacro with-current-directory (to-path &body body)
|
(defmacro with-current-directory (path &body body)
|
||||||
"Change the current OS directory to TO-PATH and execute BODY in
|
"Change the current OS directory to PATH and execute BODY in
|
||||||
an UNWIND-PROTECT, then change back to the current directory."
|
an UNWIND-PROTECT, then change back to the current directory."
|
||||||
(alexandria:with-gensyms (old)
|
(alexandria:with-gensyms (old)
|
||||||
`(let ((,old (current-directory)))
|
`(let ((,old (current-directory)))
|
||||||
(unwind-protect (progn
|
(unwind-protect (progn
|
||||||
(setf (current-directory) ,to-path)
|
(setf (current-directory) ,path)
|
||||||
,@body)
|
,@body)
|
||||||
(setf (current-directory) ,old)))))
|
(setf (current-directory) ,old)))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue