diff --git a/Plugin/src/main/java/me/filoghost/chestcommands/legacy/Backup.java b/Plugin/src/main/java/me/filoghost/chestcommands/legacy/Backup.java index ac953a2..cf11e23 100644 --- a/Plugin/src/main/java/me/filoghost/chestcommands/legacy/Backup.java +++ b/Plugin/src/main/java/me/filoghost/chestcommands/legacy/Backup.java @@ -7,15 +7,19 @@ import java.nio.file.Files; import java.nio.file.Path; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; +import java.util.Arrays; public class Backup { private final Path dataFolder; private final Path backupFolder; + private final Path infoFile; public Backup(Path dataFolder, String backupName) { this.dataFolder = dataFolder; - this.backupFolder = dataFolder.resolve("backups").resolve(backupName); + Path backupsFolder = dataFolder.resolve("old_files"); + this.backupFolder = backupsFolder.resolve(backupName); + this.infoFile = backupsFolder.resolve("readme.txt"); } public static Backup newTimestampedBackup(Path dataFolder) { @@ -31,6 +35,13 @@ public class Backup { if (!Files.isRegularFile(destination)) { Files.copy(fileToBackup, destination); } + if (!Files.isRegularFile(infoFile)) { + Files.write(infoFile, Arrays.asList( + "Files in this folders are copies of original configuration files that have been automatically upgraded.", + "", + "Note: some configuration upgrades remove comments and other formatting (such as empty lines)." + )); + } } }