diff --git a/common/src/main/java/ctbrec/Config.java b/common/src/main/java/ctbrec/Config.java index 8bbdde0f..c1885bcc 100644 --- a/common/src/main/java/ctbrec/Config.java +++ b/common/src/main/java/ctbrec/Config.java @@ -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) {