[Maxima] How to open a file given its pathname relative to the current batch script

Robert Dodier robert.dodier at gmail.com
Mon Nov 23 17:20:38 CST 2009

On Mon, Nov 23, 2009 at 3:39 PM, Manuel Fiorelli
<manuel.fiorelli at gmail.com> wrote:

> Thanks for the answer. However, this requires I know "/my/path".
> Unfortunately, I wrote a file, script.mac, which needs to
> read a file, a.txt, located in the same folder, which I don't like to
> be hard-coded. I'd like to run wxMaxima and choose "Batch file..." to
> run the script irrespectively of its position.

Hmm, I don't see an easy way, then.
Something which you can try (it's more than a little bit of a mess)
is to exploit the debugging information which is embedded in
expressions read from files.
Take a look at this: put x:1 + y; in a file and load it via batch.
Now enter:

:lisp $x

I think that shows the debugging info (including the file name).
If you want to pursue this, I'll try to explain a way to extract it.

Sorry I can't be more helpful.

Robert Dodier

More information about the Maxima mailing list