Make all the directories! \o/

This commit is contained in:
Ellpeck 2016-06-05 02:31:37 +02:00
parent c5cf9ec90f
commit ee01652574
3 changed files with 3 additions and 2 deletions

View file

@ -78,6 +78,7 @@ public class ExtraClientData{
public static File getTheFile(){ public static File getTheFile(){
try{ try{
if(!theFile.exists()){ if(!theFile.exists()){
theFile.mkdirs();
theFile.createNewFile(); theFile.createNewFile();
} }
} }

View file

@ -135,6 +135,7 @@ public class WorldData{
if(dataFile != null){ if(dataFile != null){
if(!dataFile.exists()){ if(!dataFile.exists()){
dataFile.mkdirs();
dataFile.createNewFile(); dataFile.createNewFile();
ModUtil.LOGGER.info("Creating new WorldData file for world "+data.dimension+"!"); ModUtil.LOGGER.info("Creating new WorldData file for world "+data.dimension+"!");
} }
@ -144,8 +145,6 @@ public class WorldData{
FileOutputStream stream = new FileOutputStream(dataFile); FileOutputStream stream = new FileOutputStream(dataFile);
CompressedStreamTools.writeCompressed(compound, stream); CompressedStreamTools.writeCompressed(compound, stream);
stream.close(); stream.close();
ModUtil.LOGGER.info("Saved WorldData for world "+data.dimension+"!");
} }
} }
catch(Exception e){ catch(Exception e){

View file

@ -94,6 +94,7 @@ public class ClientProxy implements IProxy{
if(ConfigBoolValues.BOOKLET_TEXT_TO_FILE.isEnabled()){ if(ConfigBoolValues.BOOKLET_TEXT_TO_FILE.isEnabled()){
File file = new File(Minecraft.getMinecraft().mcDataDir, ModUtil.MOD_ID+"booklettext.txt"); File file = new File(Minecraft.getMinecraft().mcDataDir, ModUtil.MOD_ID+"booklettext.txt");
try{ try{
file.mkdirs();
file.createNewFile(); file.createNewFile();
BufferedWriter writer = new BufferedWriter(new FileWriter(file)); BufferedWriter writer = new BufferedWriter(new FileWriter(file));
writer.write(TextFormatting.getTextWithoutFormattingCodes(bookletText)); writer.write(TextFormatting.getTextWithoutFormattingCodes(bookletText));