How to open a file given its pathname relative to the current batch script
Subject: How to open a file given its pathname relative to the current batch script
From: Raymond Toy
Date: Fri, 27 Nov 2009 11:16:09 -0500
Robert Dodier wrote:
> 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:
>
>
Finally got around to implementing $load_pathname. It seems to work,
but to be more useful, I think maxima should provide a few functions to
manipulate pathnames. Probably need one to extract the directory path,
the full file name, and maybe the extension. (If they don't already exist.)
I also noticed that file_type isn't very precise. It basically looks at
the first character of the extension to see what kind of file it is.
Ray