class AbstractCommandLineRunner {
/**
* Creates any directories necessary to write a file that will have a given
* path prefix.
*/
private static void maybeCreateDirsForPath(String pathPrefix) {
if (pathPrefix.length() > 0) {
String dirName =
pathPrefix.charAt(pathPrefix.length() - 1) == File.separatorChar
? pathPrefix.substring(0, pathPrefix.length() - 1) : new File(
pathPrefix).getParent();
if (dirName != null) {
new File(dirName).mkdirs();
}
}
}
}