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 | fe7f479e63601097c245d296140bfce0f37448b0 (patch) | |
tree | ed1d5bb9cafecf8045f919df02129a69bc2d40da /EssentialsGroupManager/src | |
parent | 50ea442bf0be605420befc97c715825b3eff9bfc (diff) | |
download | Essentials-fe7f479e63601097c245d296140bfce0f37448b0.tar Essentials-fe7f479e63601097c245d296140bfce0f37448b0.tar.gz Essentials-fe7f479e63601097c245d296140bfce0f37448b0.tar.lz Essentials-fe7f479e63601097c245d296140bfce0f37448b0.tar.xz Essentials-fe7f479e63601097c245d296140bfce0f37448b0.zip |
Auto rename all case sensitive world folders to lower case (if
possible).
Diffstat (limited to 'EssentialsGroupManager/src')
-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)) { |