renderer: replace die/catch hack with sourcepath() to obtain template path

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
Jo-Philipp Wich
2021-06-04 15:31:45 +02:00
committed by John Crispin
parent 05bc3f0532
commit 4973d24bdc

View File

@@ -40,14 +40,7 @@ function tryinclude(path, scope) {
return;
}
let parent_path = null;
// XXX: This is a somewhat convoluted way to obtain the filename of the
// calling template we're including the file for. Might eventually
// replace it with something cleaner.
try { die(); } catch(e) {
parent_path = replace(e.stacktrace[1].filename, /\/[^\/]+$/, '');
}
let parent_path = sourcepath(1, true);
assert(parent_path, "Unable to determine calling template path");