From: Robert D. <rob...@gm...> - 2019-06-12 05:04:28
|
On 2019-06-11, Stern, Michael (NIH/NIA/IRP) [E] via Maxima-discuss <max...@li...> wrote: > How can I save values, sessions to my home directory? When I do > save("file",...) from wxmaxima it saves it in the wxmaxima folder on > my C drive instead of the maxima home directory on my data drive where > everything else maxima is located, and with no extension even though > it is a lisp file. In order to load it in the usual way I need to > move it to the home directory and then add .lisp to the name to make > it accessible. How can I avoid this (other than by typing a full > filepath). When I do it from maxima.bat, it puts it in the maxima > directory on the C drive. For obvious reasons I don't wan to be > writing data to my system SSD. Well, on looking at the source code for 'save' in src/dsksetup.lisp, I see that it opens its output file without appending a path or changing the working directory or anything. So the output file will go whereever the Lisp implementation thinks is the default directory. I can see some different ways forward. One would be to append one of the existing paths, maxima_tempdir or maxima_userdir, to the file name in 'save'. That would be straightforward to do. Another idea is to call a "change directory" function. There are probably multiple implementations of such a function in various Common Lisp packages. One that I know is CHDIR in the UIOP/OS package of the UIOP project (which provides a system-independent compability layer for files and filesystem operations). UIOP is used by ASDF, which might be included in the Maxima image you are using -- try :lisp (require :asdf) and then :lisp (find-package "UIOP"). If that returns something, try :lisp (uiop/os:chdir "something/something/something"). If that succeeds, then maybe save("foo.lisp", ...) will put foo.lisp there -- I tried that and it did work as expected. If ASDF is not in your Maxima image, maybe you are willing to install Quicklisp (http://beta.quicklisp.org) and then :lisp (ql:quickload :uiop) after which try :lisp (uiop/os:chdir ...). This is all certainly a clumsy mess and I'm just trying to figure out something that could work. If all else fails then just writing save("foo/bar/baz/quux.lisp", ...) should work, and it's not too painful. Hope this helps, Robert Dodier |