[Minor] added separateHours to marshallTempFile()

This commit is contained in:
Robert von Burg 2021-01-06 11:19:46 +01:00
parent de8464d30c
commit ad8098fedc
1 changed files with 12 additions and 1 deletions

View File

@ -334,9 +334,20 @@ public class XmlHelper {
}
public static void marshallTempFile(File tempPath, String prefix, Object object) throws Exception {
marshallTempFile(tempPath, prefix, false, object);
}
public static void marshallTempFile(File tempPath, String prefix, boolean separateHours, Object object)
throws Exception {
String currentHour = normalizeLength(String.valueOf(LocalTime.now().getHour()), 2, true, '0');
String pathS = LocalDate.now() + "/" + currentHour;
String pathS;
if (separateHours)
pathS = LocalDate.now() + "/" + currentHour;
else
pathS = LocalDate.now() + "_" + currentHour;
File path = new File(tempPath, pathS);
if (!path.exists() && !path.mkdirs())
throw new IllegalStateException("Failed to create path " + path.getAbsolutePath());