How to change SBCL's current directory?

限于喜欢 提交于 2019-12-03 03:03:19
CL-USER> (sb-posix:chdir "/home/apugachev")
0
CL-USER> (sb-posix:getcwd)
"/home/apugachev"
CL-USER> (sb-posix:chdir "/tmp/")
0
CL-USER> (sb-posix:getcwd)
"/tmp"
Kripa R
(setf *default-pathname-defaults* #P"/New/Absolute/Path/")
Michał Migacz

Had the same question. Turns out

(setf *default-pathname-defaults* (truename "./subdir"))

changes load path to subdir. If you don't want relative path, then

(setf *default-pathname-defaults* (truename "/absolute/path"))

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))

Now i use rlwrap to run SBCL and solves this problem

$"cat ~/bin/sb"
breakchars="(){}[],^%$#@\"\";:''|\\"

cd /media/E/www/qachina/db/doc/money/
exec rlwrap --remember -c -b "$breakchars"  -f "$HOME"/.sbcl_completions sbcl "$@"

then run sb.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!