| Summary: | [EGL] TemplateFactory#load changes the path from which templates are loaded | ||
|---|---|---|---|
| Product: | [Modeling] Epsilon | Reporter: | Louis Rose <louis> |
| Component: | Core | Assignee: | Louis Rose <louis> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | dkolovos |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | interim | ||
This was caused by EglModule's execute method, which was calling TemplateFactory#setRoot whenever a template (or subtemplate) was executed. I've changed the execute method to only change the root of the TemplateFactory if it has not been set already (using a new method: TemplateFactory#initialiseRoot). I've added a regression test to cover this: InvokingSubtemplates.java Fix committed to SVN. While this fix is in the oven, I think there is a workaround. At the very start of a main template, invoke the following operation to force EGL to resolve all templates relative to the directory containing the main template:
[%
operation ensureTemplatesAreResolvedRelativeToBaseTemplate() {
// This is a temporary workaround, required for:
// - Epsilon 0.9.1.201107251201 (stable)
// - Epsilon 0.9.1.201107251210 (interim)
// For more information, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=355820
var baseUri = TemplateFactory.context.baseTemplate.uri;
var baseDir = new Native("java.io.File")(baseUri).getParentFile();
TemplateFactory.setTemplateRoot(baseDir.absolutePath);
}
%]
This workaround won't be necessary once the fix makes it into the next interim / stable releases.
Fixed in 1.0 |
For the following directory structure: Driver.egl first/First.egl second/Second.egl where Driver.egl contains: [%=TemplateFactory.load('first/First.egl').process()%] [%=TemplateFactory.load('second/Second.egl').process()%] EGL throws a FileNotFoundException, while trying to load 'second/Second.egl'. It appears that EGL is trying to load a template at 'first/second/Second.egl', which seems to indicate that TemplateFactory#load has the (counter-intuitive) side-effect of changing the location from which templates are loaded.