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: Tue, 24 Nov 2009 20:40:53 -0500
Robert Dodier wrote:
> On Mon, Nov 23, 2009 at 5:45 PM, Manuel Fiorelli
> <manuel.fiorelli at gmail.com> wrote:
>
>
>>> I should use "filename_merge (path, filename)", right?
>>>
>
> Yup, I guess so.
>
>
>> Even if I don't know Lisp I came to this code
>>
>> :lisp (car (cdr (car (cdr (cdr (car $x))))));
>>
>
> Here's a very slightly more general formulation.
> (I don't think the order of the items in the car of an expression is fixed.)
>
> (defun $extract_filename (e)
> (let ((l (car e)))
> (loop for x in l do
> (if (and (consp x) (eq (car (last x)) 'src))
> (return (second x))))))
>
> Then you should find extract_filename(x) returns the path + script name.
>
> As I said before, this is kind of a mess, but I don't see a better way.
>
>
I have not investigated whether this is possible or not, but perhaps we
can follow lisp and make $load_pathname be set to the pathname of the
file being loaded. This is analogous to how Lisp handles *load-pathname*.
Ray