Skip to content

Commit

Permalink
Absolute path is also supported in FmppTemplateLoader
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaly Dyachkov committed Nov 18, 2019
1 parent 3d9bf2a commit 3780538
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
eclipse.preferences.version=1
encoding//src/docs/index.html=ISO-8859-1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8
10 changes: 7 additions & 3 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
4 changes: 4 additions & 0 deletions .settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
6 changes: 6 additions & 0 deletions src/main/java/fmpp/FmppTemplateLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ public FmppTemplateLoader(Engine engine)

public Object findTemplateSource(String name)
throws IOException {

File absolutePathFile = new File(name);
if(absolutePathFile.isAbsolute() && absolutePathFile.isFile()) {
return absolutePathFile;
}

if (name.indexOf('\\') != -1) {
throw new IOException("Malformed path. FreeMarker paths use slash "
+ "(/) to separate path components, not backslash (\\). "
Expand Down

0 comments on commit 3780538

Please sign in to comment.