From: keyboard
Subject: How to change directory/path in SBCL?
Date: 
Message-ID: <1175137585.667159.11910@o5g2000hsb.googlegroups.com>
Hi, All:

I am trying SBCL 1.02 for WIN32 X86. I do not know how to change
directory under the SBCL system. When I load a lisp file using the
true/full path name, many files which have relative path to that file
cannot be loaded, so I would like to go to the directory first and
load the file there.

How to do this?

best regards,
keyboard

From: Slava Akhmechet
Subject: Re: How to change directory/path in SBCL?
Date: 
Message-ID: <87abxwoic9.fsf@gmail.com>
If you use Slime to connect to it, just type , c d RET in the interpreter.
From: Harald Hanche-Olsen
Subject: Re: How to change directory/path in SBCL?
Date: 
Message-ID: <pcolkhg4jdu.fsf@shuttle.math.ntnu.no>
+ "keyboard" <···········@gmail.com>:

| When I load a lisp file using the true/full path name, many files
| which have relative path to that file cannot be loaded

The usual way to deal with this is to construct the full pathname of
the files you wish to load by using

  (merge-pathnames relative-path *load-truename*)

as the pathname to load.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell
From: keyboard
Subject: Re: How to change directory/path in SBCL?
Date: 
Message-ID: <1175153044.993826.20790@d57g2000hsg.googlegroups.com>
On 29 Mrz., 15:08, Harald Hanche-Olsen <······@math.ntnu.no> wrote:
> + "keyboard" <···········@gmail.com>:
>
> | When I load a lisp file using the true/full path name, many files
> | which have relative path to that file cannot be loaded
>
> The usual way to deal with this is to construct the full pathname of
> the files you wish to load by using
>
>   (merge-pathnames relative-path *load-truename*)
>
> as the pathname to load.
>
> --
> * Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
> - It is undesirable to believe a proposition
>   when there is no ground whatsoever for supposing it is true.
>   -- Bertrand Russell

Thank you. But is there something like clisp (ext:cd) in SBCL?
From: Harald Hanche-Olsen
Subject: Re: How to change directory/path in SBCL?
Date: 
Message-ID: <pcomz1vx699.fsf@shuttle.math.ntnu.no>
+ "keyboard" <···········@gmail.com>:

| But is there something like clisp (ext:cd) in SBCL?

There is sb-posix:chdir.  But see Pascal Bourguignon's other remark in
the thread.

-- 
* Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
  when there is no ground whatsoever for supposing it is true.
  -- Bertrand Russell
From: keyboard
Subject: Re: How to change directory/path in SBCL?
Date: 
Message-ID: <1175223366.958676.38660@b75g2000hsg.googlegroups.com>
On 30 Mrz., 02:18, Harald Hanche-Olsen <······@math.ntnu.no> wrote:
> + "keyboard" <···········@gmail.com>:
>
> | But is there something like clisp (ext:cd) in SBCL?
>
> There is sb-posix:chdir.  But see Pascal Bourguignon's other remark in
> the thread.
>
> --
> * Harald Hanche-Olsen     <URL:http://www.math.ntnu.no/~hanche/>
> - It is undesirable to believe a proposition
>   when there is no ground whatsoever for supposing it is true.
>   -- Bertrand Russell


Thank you all.

I tried to build movitz under CLISP, LispWorks(Personal) and SBCL for
windows, none of them succeeded. Do I really need a linux box to work
on?

best regards,
keyboard
From: Pascal Bourguignon
Subject: Re: How to change directory/path in SBCL?
Date: 
Message-ID: <87wt0xtdgq.fsf@voyager.informatimago.com>
"keyboard" <···········@gmail.com> writes:
> I tried to build movitz under CLISP, LispWorks(Personal) and SBCL for
> windows, none of them succeeded. Do I really need a linux box to work
> on?

If you're not masochist, yes.  ;-)
You might try cygwin (http://www.cygwin.com),
or coLinux (http://www.colinux.org),
or even a true unix system on Qemu (http://www.qemu.org).

-- 
__Pascal Bourguignon__
http://www.informatimago.com
http://pjb.ogamita.org
From: Pascal Bourguignon
Subject: Re: How to change directory/path in SBCL?
Date: 
Message-ID: <87lkhgv6e2.fsf@voyager.informatimago.com>
Harald Hanche-Olsen <······@math.ntnu.no> writes:

> + "keyboard" <···········@gmail.com>:
>
> | When I load a lisp file using the true/full path name, many files
> | which have relative path to that file cannot be loaded
>
> The usual way to deal with this is to construct the full pathname of
> the files you wish to load by using
>
>   (merge-pathnames relative-path *load-truename*)
>
> as the pathname to load.

And CL usually maintains a different "current working directory" than
the underlying posix system (which may not even exist, for a given CL
implementation).

That is: *DEFAULT-PATHNAME-DEFAULTS*

So, the CL way of doing  chdir(path);
is  (setf *DEFAULT-PATHNAME-DEFAULTS* path)

A MERGE-PATHNAMES with this default path is done automatically by most
of the CL functions dealing with files.

Of course, if your implementation works on posix and provides a way to
use chdir(2), you might want to keep both synchronized.

(defun cd (path)
  (setf *default-pathname-defaults* path)
  #+(and clisp linux) (linux:|chdir| (namestring (truename path)))
  #|and other implementation dependent insanities...|#)


-- 
__Pascal Bourguignon__
http://www.informatimago.com
http://pjb.ogamita.org