Auto rename all case sensitive world folders to lower case (if

possible).
This commit is contained in:
ElgarL 2012-03-26 20:06:59 +01:00
parent 50ea442bf0
commit fe7f479e63
2 changed files with 24 additions and 3 deletions

View File

@ -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).
- 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).

View File

@ -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)) {