diff options
Diffstat (limited to 'support/texplate/source/main/kotlin/org/islandoftex/texplate/util/PathUtils.kt')
-rw-r--r-- | support/texplate/source/main/kotlin/org/islandoftex/texplate/util/PathUtils.kt | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/support/texplate/source/main/kotlin/org/islandoftex/texplate/util/PathUtils.kt b/support/texplate/source/main/kotlin/org/islandoftex/texplate/util/PathUtils.kt index 3a74603557..d0212769ec 100644 --- a/support/texplate/source/main/kotlin/org/islandoftex/texplate/util/PathUtils.kt +++ b/support/texplate/source/main/kotlin/org/islandoftex/texplate/util/PathUtils.kt @@ -39,7 +39,12 @@ object PathUtils { @JvmStatic @Throws(FileNotFoundException::class) fun getTemplatePath(name: String): Path { - // the file has to be a TOML format, so we add the extension + // if the name represents an existing TOML file, we assume the user wants this + // file + if (name.endsWith(".toml") && Files.exists(Paths.get(name))) + return Paths.get(name) + // if not, then we test for the file in texplate's search path + // it has to be in TOML format and without extension val fullName = "$name.toml" // the first reference is based on the user template path resolved with the // file name |