Throw an Exception when WorldSettings fail to create the required directory structure.
This commit is contained in:
parent
d917ae7765
commit
4b83c804cf
2 changed files with 33 additions and 15 deletions
|
@ -47,10 +47,6 @@ public class WorldSettings extends Configuration
|
|||
|
||||
compass = new CompassService( AEFolder );
|
||||
|
||||
File spawnData = new File( AEFolder, "spawndata" );
|
||||
if ( !spawnData.exists() || !spawnData.isDirectory() )
|
||||
spawnData.mkdir();
|
||||
|
||||
for (int dimID : get( "DimensionManager", "StorageCells", new int[0] ).getIntList())
|
||||
{
|
||||
storageCellDims.add( dimID );
|
||||
|
@ -85,7 +81,7 @@ public class WorldSettings extends Configuration
|
|||
fis = new FileInputStream( f );
|
||||
|
||||
NBTTagCompound data = null;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
data = CompressedStreamTools.readCompressed( fis );
|
||||
|
@ -95,9 +91,9 @@ public class WorldSettings extends Configuration
|
|||
data = new NBTTagCompound();
|
||||
AELog.error( e );
|
||||
}
|
||||
|
||||
|
||||
fis.close();
|
||||
|
||||
|
||||
return data;
|
||||
}
|
||||
catch (Throwable e)
|
||||
|
@ -121,16 +117,16 @@ public class WorldSettings extends Configuration
|
|||
{
|
||||
// save
|
||||
FileOutputStream fos = new FileOutputStream( f );
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
CompressedStreamTools.writeCompressed( data, fos );
|
||||
}
|
||||
catch( Throwable e )
|
||||
catch (Throwable e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
|
||||
|
||||
fos.close();
|
||||
}
|
||||
catch (Throwable e)
|
||||
|
@ -256,12 +252,29 @@ public class WorldSettings extends Configuration
|
|||
{
|
||||
File world = DimensionManager.getCurrentSaveRootDirectory();
|
||||
|
||||
File f = new File( world.getPath() + File.separatorChar + "AE2" );
|
||||
File aeBaseFolder = new File( world.getPath() + File.separatorChar + "AE2" );
|
||||
|
||||
if ( !f.exists() || !f.isDirectory() )
|
||||
f.mkdir();
|
||||
if ( !aeBaseFolder.exists() || !aeBaseFolder.isDirectory() )
|
||||
if ( !aeBaseFolder.mkdir() )
|
||||
{
|
||||
throw new RuntimeException( "Failed to create " + aeBaseFolder.getAbsolutePath() );
|
||||
}
|
||||
|
||||
instance = new WorldSettings( f );
|
||||
File compass = new File( aeBaseFolder, "compass" );
|
||||
if ( !compass.exists() || !compass.isDirectory() )
|
||||
if ( !compass.mkdir() )
|
||||
{
|
||||
throw new RuntimeException( "Failed to create " + compass.getAbsolutePath() );
|
||||
}
|
||||
|
||||
File spawnData = new File( aeBaseFolder, "spawndata" );
|
||||
if ( !spawnData.exists() || !spawnData.isDirectory() )
|
||||
if ( !spawnData.mkdir() )
|
||||
{
|
||||
throw new RuntimeException( "Failed to create " + spawnData.getAbsolutePath() );
|
||||
}
|
||||
|
||||
instance = new WorldSettings( aeBaseFolder );
|
||||
}
|
||||
|
||||
return instance;
|
||||
|
|
|
@ -5,6 +5,8 @@ import java.io.RandomAccessFile;
|
|||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.FileChannel;
|
||||
|
||||
import appeng.core.AELog;
|
||||
|
||||
public class CompassRegion
|
||||
{
|
||||
|
||||
|
@ -159,7 +161,10 @@ public class CompassRegion
|
|||
File folderFile = new File( folder );
|
||||
|
||||
if ( !folderFile.exists() || !folderFile.isDirectory() )
|
||||
folderFile.mkdir();
|
||||
{
|
||||
if ( !folderFile.mkdir() )
|
||||
AELog.info( "Failed to created AE2/compass/" );
|
||||
}
|
||||
|
||||
return new File( folder + File.separatorChar + world + "_" + low_x + "_" + low_z + ".dat" );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue