Add README.txt in backups folder

This commit is contained in:
filoghost 2021-08-07 16:13:29 +02:00
parent 72cdacb998
commit 5225d34cb6
1 changed files with 12 additions and 0 deletions

View File

@ -13,6 +13,7 @@ import me.filoghost.holographicdisplays.plugin.config.ConfigManager;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Collections;
public abstract class LegacyUpgrade implements LegacyUpgradeTask {
@ -63,6 +64,17 @@ public abstract class LegacyUpgrade implements LegacyUpgradeTask {
errorCollector.add(e, "error while copying file \"" + configManager.formatPath(file) + "\""
+ " to \"" + configManager.formatPath(backupsFolder) + "\"");
}
Path readMeFile = backupsFolder.resolve("README.txt");
if (!Files.isRegularFile(readMeFile)) {
try {
Files.write(readMeFile, Collections.singletonList(
"This folder is used to backup configuration files before automatically upgrading them to a newer format."
));
} catch (IOException ignore) {
// The file is not important
}
}
}
private Path getAlternativeCopyFile(Path file, int copyIndex) {