Fix error in backupConfig, if config dir does not wxist yet
This commit is contained in:
parent
97087c601a
commit
776cee271a
|
@ -71,10 +71,12 @@ public class Config {
|
|||
private void backupConfig(File currentConfigDir) throws IOException {
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(RECORDING_DATE_FORMAT);
|
||||
File src = currentConfigDir;
|
||||
File target = new File(src.getParentFile(), src.getName() + "_backup_" + dateTimeFormatter.format(LocalDateTime.now()));
|
||||
LOG.info("Creating a backup of the config in {}", target);
|
||||
FileUtils.copyDirectory(src, target, pathname -> !(pathname.toString().contains("minimal-browser") && pathname.toString().contains("Cache")), true);
|
||||
deleteOldBackups(currentConfigDir);
|
||||
if (src.exists()) {
|
||||
File target = new File(src.getParentFile(), src.getName() + "_backup_" + dateTimeFormatter.format(LocalDateTime.now()));
|
||||
LOG.info("Creating a backup of the config in {}", target);
|
||||
FileUtils.copyDirectory(src, target, pathname -> !(pathname.toString().contains("minimal-browser") && pathname.toString().contains("Cache")), true);
|
||||
deleteOldBackups(currentConfigDir);
|
||||
}
|
||||
}
|
||||
|
||||
private void deleteOldBackups(File currentConfigDir) {
|
||||
|
|
Loading…
Reference in New Issue