Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change SBCL's current directory?

It is very easy to change CLisp's current working directory:

>cat ~/.clisprc.lisp 
;;; The following lines added by ql:add-to-init-file:
#-quicklisp
(let ((quicklisp-init (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname))))
  (when (probe-file quicklisp-init)
  (load quicklisp-init)))

(cd "/media/E/www/qachina/db/doc/money")
(load "money")

However, it seems there is no cd similar function in SBCL. How can this be done with SBCL?

like image 556
z_axis Avatar asked Oct 12 '11 05:10

z_axis


2 Answers

Right now, better answer is: use (uiop:chdir "some/path").

Or you can use this function to change directory temporarily:

(uiop:call-with-current-directory "some/path" (lambda () (do-the-job))

Or this macro for more convenient way:

(uiop:with-current-directory ("some/path") (do-the-job))

like image 95
Alexander Artemenko Avatar answered Oct 01 '22 13:10

Alexander Artemenko


(setf *default-pathname-defaults* #P"/New/Absolute/Path/")
like image 26
Kripa R Avatar answered Oct 01 '22 13:10

Kripa R