use of lucee.transformer.library.function.FunctionLibException in project Lucee by lucee.
the class ConfigImpl method setFldFile.
protected void setFldFile(Resource fileFld, int dialect) throws FunctionLibException {
if (dialect == CFMLEngine.DIALECT_BOTH) {
setFldFile(fileFld, CFMLEngine.DIALECT_CFML);
setFldFile(fileFld, CFMLEngine.DIALECT_LUCEE);
return;
}
FunctionLib[] flds = dialect == CFMLEngine.DIALECT_CFML ? cfmlFlds : luceeFlds;
// merge all together (backward compatibility)
if (flds.length > 1)
for (int i = 1; i < flds.length; i++) {
overwrite(flds[0], flds[i]);
}
flds = new FunctionLib[] { flds[0] };
if (dialect == CFMLEngine.DIALECT_CFML) {
cfmlFlds = flds;
// TODO improve check
if (cfmlFlds != flds)
combinedCFMLFLDs = null;
} else {
luceeFlds = flds;
// TODO improve check
if (luceeFlds != flds)
combinedLuceeFLDs = null;
}
if (fileFld == null)
return;
this.fldFile = fileFld;
// overwrite with addional functions
FunctionLib fl;
if (fileFld.isDirectory()) {
Resource[] files = fileFld.listResources(new ExtensionResourceFilter(new String[] { "fld", "fldx" }));
for (int i = 0; i < files.length; i++) {
try {
fl = FunctionLibFactory.loadFromFile(files[i], getIdentification());
overwrite(flds[0], fl);
} catch (FunctionLibException fle) {
SystemOut.printDate(out, "can't load fld " + files[i]);
fle.printStackTrace(getErrWriter());
}
}
} else {
fl = FunctionLibFactory.loadFromFile(fileFld, getIdentification());
overwrite(flds[0], fl);
}
}
Aggregations