diff options
author | ElgarL <ElgarL@palmergames.com> | 2012-03-26 20:06:59 +0100 |
---|---|---|
committer | ElgarL <ElgarL@palmergames.com> | 2012-03-26 20:06:59 +0100 |
commit | e02a27fc8eb39008cb84f88c4c946d8be595c103 (patch) | |
tree | 82a5eb85ee8e6cd2fa51b4a3b7c39e01fa5d2f8b | |
parent | 246c62ea153d1a622646e424eff25c6f665c8295 (diff) | |
download | Essentials-e02a27fc8eb39008cb84f88c4c946d8be595c103.tar Essentials-e02a27fc8eb39008cb84f88c4c946d8be595c103.tar.gz Essentials-e02a27fc8eb39008cb84f88c4c946d8be595c103.tar.lz Essentials-e02a27fc8eb39008cb84f88c4c946d8be595c103.tar.xz Essentials-e02a27fc8eb39008cb84f88c4c946d8be595c103.zip |
Auto rename all case sensitive world folders to lower case (if
possible).
-rw-r--r-- | EssentialsGroupManager/src/Changelog.txt | 3 | ||||
-rw-r--r-- | EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java | 24 |
2 files changed, 24 insertions, 3 deletions
diff --git a/EssentialsGroupManager/src/Changelog.txt b/EssentialsGroupManager/src/Changelog.txt index 5ee1a386e..bbc8abe82 100644 --- a/EssentialsGroupManager/src/Changelog.txt +++ b/EssentialsGroupManager/src/Changelog.txt @@ -152,4 +152,5 @@ v 1.9: - Expanded '/manuadd'to accept an optional variable for the world (eg '/manuadd <player> <group> <world>').
- Removed some debug spam.
- Don't remove an attachment on a player leaving as Bukkit never forgets it. This fixes non mirrored permissions being messed up if a player relogs.
- - Treat all world names as lower case for file handling (please check in your worlds folder. You should have no folders with upper case letters from now).
\ No newline at end of file + - Treat all world names as lower case for file handling (please check in your worlds folder. You should have no folders with upper case letters from now).
+ - Auto rename all case sensitive world folders to lower case (if possible).
\ No newline at end of file diff --git a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java index 35e8794b5..bfa7d5cd2 100644 --- a/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java +++ b/EssentialsGroupManager/src/org/anjocaido/groupmanager/dataholder/worlds/WorldsHolder.java @@ -106,7 +106,12 @@ public class WorldsHolder { if (!worldsData.containsKey(folder.getName().toLowerCase()) && ((!mirrorsGroup.containsKey(folder.getName().toLowerCase())) || (!mirrorsUser.containsKey(folder.getName().toLowerCase())))) { - loadWorld(folder.getName()); + /* + * Call setupWorldFolder to check case sensitivity + * and convert to lower case, before we attempt to load this world. + */ + setupWorldFolder(folder.getName()); + loadWorld(folder.getName().toLowerCase()); } } @@ -454,7 +459,22 @@ public class WorldsHolder { File defaultWorldFolder = new File(worldsFolder, worldNameLowered); if ((!defaultWorldFolder.exists()) && ((!mirrorsGroup.containsKey(worldNameLowered))) || (!mirrorsUser.containsKey(worldNameLowered))) { - defaultWorldFolder.mkdirs(); + + /* + * check and convert all old case sensitive folders to lower case + */ + File casedWorldFolder = new File(worldsFolder, worldName); + if ((casedWorldFolder.exists()) && (casedWorldFolder.getName().toLowerCase().equals(worldNameLowered))) { + /* + * Rename the old folder to the new lower cased format + */ + casedWorldFolder.renameTo(new File(worldsFolder, worldNameLowered)); + } else { + /* + * Else we just create the folder + */ + defaultWorldFolder.mkdirs(); + } } if (defaultWorldFolder.exists()) { if (!mirrorsGroup.containsKey(worldNameLowered)) { |