if (Files.isDirectory(appPath)) {
workingPath = Files.createDirectories(appPath.toAbsolutePath());
} else {
// must be running from within a JAR- get the working directory excluding the file name of the archive
workingPath = appPath.getParent();
workingPath = workingPath == null ? appPath.subpath(0, 1).toAbsolutePath() :
workingPath.toAbsolutePath();
log.debug(String.format("Extracted working directory %1$s from application path %2$s", workingPath, appPath));
appPath = workingPath;
}
if (subDirectory != null) {