Aufgrund eines Versionsupdates wird GitLab am 17.12. zwischen 9:00 und 9:30 Uhr kurzzeitig nicht zur Verfügung stehen. / Due to a version upgrade, GitLab won't be accessible at 17.12. between 9 and 9:30 a.m.

Fixed: now loads templates as resources instead of files

parent d5245eb6
package de.monticore.lang.monticar.generator.middleware.helpers;
import de.se_rwth.commons.logging.Log;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
......@@ -16,12 +15,13 @@ public class TemplateHelper {
}
String tmpStr = "";
String fullFileName = "src/main/resources/de/monticore/lang/monticar/generator/middleware/" + fileName;
String resourceFileName = "/de/monticore/lang/monticar/generator/middleware/" + fileName;
try {
tmpStr = FileUtils.readFileToString(new File(fullFileName));
tmpStr = IOUtils.toString(TemplateHelper.class.getResourceAsStream(resourceFileName));
} catch (Exception e) {
//Not recoverable
Log.error("Template file not found: " + fullFileName);
Log.error("Template file not found: " + resourceFileName);
}
cache.put(fileName, tmpStr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment