How to change SBCL's current directory?

前端 未结 5 1907
孤街浪徒
孤街浪徒 2021-02-08 10:25

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         


        
相关标签:
5条回答
  • 2021-02-08 11:12

    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"))
    
    0 讨论(0)
  • 2021-02-08 11:12
    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"
    
    0 讨论(0)
  • 2021-02-08 11:13

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

    0 讨论(0)
  • 2021-02-08 11:17

    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.

    0 讨论(0)
  • 2021-02-08 11:20
    (setf *default-pathname-defaults* #P"/New/Absolute/Path/")
    
    0 讨论(0)
提交回复
热议问题