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: Robert Dodier
Date: Tue, 24 Nov 2009 10:40:16 -0700
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.
best,
Robert Dodier