From 352dd29ca61bb6e8a530ad2efcd8cdadc6a082a4 Mon Sep 17 00:00:00 2001 From: Phoenix616 Date: Thu, 21 Mar 2024 14:11:28 +0100 Subject: [PATCH] Rename old uppercase datafolder to lowercase if it existed This should do nothing on file systems which ignore the case --- .../net/azisaba/kuvel/config/KuvelConfig.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/net/azisaba/kuvel/config/KuvelConfig.java b/src/main/java/net/azisaba/kuvel/config/KuvelConfig.java index e6c528b0..21ca2978 100644 --- a/src/main/java/net/azisaba/kuvel/config/KuvelConfig.java +++ b/src/main/java/net/azisaba/kuvel/config/KuvelConfig.java @@ -23,6 +23,21 @@ public class KuvelConfig { @Nullable private String proxyGroupName; public void load() throws IOException { + File uppercaseDataFolder = new File(plugin.getDataDirectory().getParentFile(), "Kuvel"); + if (uppercaseDataFolder.exists() && !plugin.getDataDirectory().exists()) { + if (uppercaseDataFolder.renameTo(plugin.getDataDirectory())) { + plugin + .getLogger() + .info( + "Successfully renamed the data folder to use a lowercase name."); + } else { + plugin + .getLogger() + .warn( + "Failed to rename the data folder to be lowercase. Please manually rename the data folder to 'kuvel'."); + } + } + VelocityConfigLoader conf = VelocityConfigLoader.load(new File(plugin.getDataDirectory(), CONFIG_FILE_NAME)); conf.saveDefaultConfig();