I am going to start a new thread for this because this is a cool
feature that will need some testing.

In the headlines of @file, @thin, @shadow nodes, etc, Leo will
evaluate {{expr}} and substitute the result in the path. For example,
test.leo contains the following setting:

@string test = c:\leo.repo\trunk\leo\test

So the node:

@shadow {{c.config.getString('test')}}/eval-shadow-test.txt

is equivalent to:

@shadow c:\leo.repo\trunk\leo\test\eval-shadow-test.txt

Which is pretty cool.  The evaluation is done by a helper of
g.os_path_finalize and g.os_path_finalize_join, in a context with
'g','os' and 'sys' defined.

Similarly, in places where 'c' is defined, Leo uses c.os_path_finalize
and c.os_path_finalize_join.  In those cases, the expression is
evaluated in a context with 'c','g','p','os' and 'sys' defined.

Warning: this feature is lightly tested. The code that evaluates
expression is not the problem.  Rather, the problem is that there are/
were dozens of calls to g.os_path_finalize and g.os_path_finalize_join
in Leo's core, and some (but not all!) of those calls can be converted
to the corresponding g.os_path methods.

For example, it had better be the case that the atFile write methods
use the same methods as the atFile read methods.  It *appears* that
this is so (this feature works with @thin, @file and @shadow) but
there are plenty of opportunities for subtle problems.

In short, please do use this feature, but be careful.

Edward

P.S. As I write this, I'm not sure whether @path supports {{expr}}
yet, but it will eventually.  I don't say 'immediately' because there
is some tricky integration of the new directive-handling code to be
done first.

EKR

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to