diff options
author | Norbert Preining <norbert@preining.info> | 2020-01-18 03:01:23 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-01-18 03:01:23 +0000 |
commit | 22d3a7ddeb2b2637308cf883f9bd3590e649aa20 (patch) | |
tree | e5887f868c532734a8cac1c7833f5492370effb5 /support/texplate/source | |
parent | e71ffee2103e3f137bbc9ee526858bc277e95908 (diff) |
CTAN sync 202001180301
Diffstat (limited to 'support/texplate/source')
-rw-r--r-- | support/texplate/source/main/java/org/islandoftex/texplate/util/MessageUtils.java | 2 | ||||
-rw-r--r-- | support/texplate/source/main/java/org/islandoftex/texplate/util/PathUtils.java | 36 |
2 files changed, 22 insertions, 16 deletions
diff --git a/support/texplate/source/main/java/org/islandoftex/texplate/util/MessageUtils.java b/support/texplate/source/main/java/org/islandoftex/texplate/util/MessageUtils.java index 948d18d953..7649a60e82 100644 --- a/support/texplate/source/main/java/org/islandoftex/texplate/util/MessageUtils.java +++ b/support/texplate/source/main/java/org/islandoftex/texplate/util/MessageUtils.java @@ -18,7 +18,7 @@ public class MessageUtils { private static final int WIDTH = 60; // the application version - private static final String VERSION = "1.0.0"; + private static final String VERSION = "1.0.1"; /** * Prints a line in the terminal, without a line break. diff --git a/support/texplate/source/main/java/org/islandoftex/texplate/util/PathUtils.java b/support/texplate/source/main/java/org/islandoftex/texplate/util/PathUtils.java index 26e101b9ad..fa242c4980 100644 --- a/support/texplate/source/main/java/org/islandoftex/texplate/util/PathUtils.java +++ b/support/texplate/source/main/java/org/islandoftex/texplate/util/PathUtils.java @@ -2,11 +2,12 @@ package org.islandoftex.texplate.util; import io.vavr.control.Try; +import org.islandoftex.texplate.Main; + import java.io.FileNotFoundException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import org.islandoftex.texplate.Main; /** * Helper methods for path handling. @@ -62,7 +63,6 @@ public class PathUtils { */ private static Path searchTemplatePath(String name) throws FileNotFoundException { - // the file has to be a TOML format, // so we add the extension name = name.concat(".toml"); @@ -75,13 +75,11 @@ public class PathUtils { // if the file actually exists, // the search is done! if (Files.exists(reference)) { - // return the template // file reference return reference; } else { - // the reference was not found in the // user location, so let us try the // system counterpart @@ -90,22 +88,30 @@ public class PathUtils { // if the file actually exists, // the search is done! if (Files.exists(reference)) { - // return the template // file reference return reference; } else { - - // the file reference could not be - // found, so an exception is thrown - throw new FileNotFoundException("I am sorry, but the template " - + "file '" + name + "' could not be found in the " - + "default template locations (system and user). Make " - + "sure the reference is correct and try again. For " - + "reference, these are the paths I searched: '" - + getUserTemplatePath() + "' and '" - + getDefaultTemplatePath() + "' (in this order)."); + // in the system path, look for an `texplate` prefixed + // version as well + reference = getDefaultTemplatePath().resolve("texplate-" + name); + + if (Files.exists(reference)) { + // return the template + // file reference + return reference; + } else { + // the file reference could not be + // found, so an exception is thrown + throw new FileNotFoundException("I am sorry, but the template " + + "file '" + name + "' could not be found in the " + + "default template locations (system and user). Make " + + "sure the reference is correct and try again. For " + + "reference, these are the paths I searched: '" + + getUserTemplatePath() + "' and '" + + getDefaultTemplatePath() + "' (in this order)."); + } } } } |