Changed getEnv() to getProjectDir()

This commit is contained in:
Erik C. Thauvin 2019-04-19 13:55:21 -07:00
parent 7f838e9863
commit 06263ee003

View file

@ -91,7 +91,7 @@ public class VersionProcessor extends AbstractProcessor {
final VersionInfo versionInfo = new VersionInfo(version); final VersionInfo versionInfo = new VersionInfo(version);
if (version.properties().length() > 0) { if (version.properties().length() > 0) {
final File propsFile = new File(getEnv(Constants.SEMVER_PROJECT_DIR_ARG, version.properties())); final File propsFile = new File(getProjectDir(version.properties()));
if (propsFile.isFile() && propsFile.canRead()) { if (propsFile.isFile() && propsFile.canRead()) {
note("Found properties: " + propsFile + " (" + propsFile.getAbsoluteFile().getParent() + ')'); note("Found properties: " + propsFile + " (" + propsFile.getAbsoluteFile().getParent() + ')');
@ -138,9 +138,9 @@ public class VersionProcessor extends AbstractProcessor {
return versionInfo; return versionInfo;
} }
private String getEnv(String envOption, String fileName) { private String getProjectDir(String fileName) {
if (processingEnv != null) { // null when testing. if (processingEnv != null) { // null when testing.
final String prop = processingEnv.getOptions().get(envOption); final String prop = processingEnv.getOptions().get(Constants.SEMVER_PROJECT_DIR_ARG);
if (prop != null) { if (prop != null) {
return prop + File.separator + fileName; return prop + File.separator + fileName;
} }
@ -245,7 +245,7 @@ public class VersionProcessor extends AbstractProcessor {
final String template) final String template)
throws IOException { throws IOException {
final MustacheFactory mf = new DefaultMustacheFactory( final MustacheFactory mf = new DefaultMustacheFactory(
new File(getEnv(Constants.SEMVER_PROJECT_DIR_ARG, "."))); new File(getProjectDir(".")));
final Mustache mustache = mf.compile(template); final Mustache mustache = mf.compile(template);
final String templateName; final String templateName;