Raymond Toy <toy.raymond at gmail.com> writes:
>>>>>> "Leo" == Leo Butler <l_butler at users.sourceforge.net> writes:
>
> Leo> How about the following:
>
> Leo> :lisp (defun $directory_part (pathname) ($printf nil "/~a" (apply #'combine-path (rest (pathname-directory pathname)))))
>
> Leo> Now, in your batch file you can access the directory name via:
>
> Leo> dirname : directory_part(load_pathname);
>
> Look at pathname_directory; I think it does what your $directory_part
> does.
I did, and with sbcl at least, pathname_directory barfs on a string
input. I guess you consider that a bug?
>
> >>
> >> Looking quickly through the manual, I couldn't see a way to change the
> >> current working directory in the Maxima language. Is that something you
> >> would use?
>
> Leo> There aren't any directory/file stuff exposed to the Maxima top-level,
> Leo> that I am aware of, but here are a few functions that let you do this:
>
> In addition to pathname_directory, there's pathname_type and
> pathname_name. Not sure exactly what kind of stuff you're interested
> in.
Same as above.
>
> Leo> We need to create a cd function without the system command, because
> Leo> system launches a subshell, and we want to change the cwd of the Maxima process:
>
> Look at xchdir in server.lisp. It's not directly exposed to maxima,
> but it looks like it will change the current directory on all the
> supported lisp implementations, except ccl. (We probably need to fix
> that.)
Yes, $cd is really just an alias for xchdir.
--
Leo Butler <l_butler at users.sourceforge.net>
SDF Public Access UNIX System - http://sdf.lonestar.org