Merge pull request #1102 from thatsIch/e-854-file-ctor

Completes #854 Use superior file constructor to not care about file separator
This commit is contained in:
thatsIch 2015-03-26 22:55:54 +01:00
commit 369a82889c
2 changed files with 7 additions and 7 deletions

View file

@ -61,7 +61,7 @@ public class WorldSettings extends Configuration
private static WorldSettings instance;
private final List<Integer> storageCellDims = new ArrayList<Integer>();
private final File aeFolder;
private final File spawnDataFolder;
private final CompassService compass;
private final PlayerMappings mappings;
private final Map<GridStorageSearch, WeakReference<GridStorageSearch>> loadedStorage = new WeakHashMap<GridStorageSearch, WeakReference<GridStorageSearch>>();
@ -70,8 +70,8 @@ public class WorldSettings extends Configuration
public WorldSettings( File aeFolder )
{
super( new File( aeFolder.getPath() + File.separatorChar + "settings.cfg" ) );
this.aeFolder = aeFolder;
super( new File( aeFolder.getPath(), "settings.cfg" ) );
this.spawnDataFolder = new File( aeFolder, SPAWNDATA_FOLDER );
this.compass = new CompassService( aeFolder );
for ( int dimID : this.get( "DimensionManager", "StorageCells", new int[0] ).getIntList() )
@ -101,7 +101,7 @@ public class WorldSettings extends Configuration
{
File world = DimensionManager.getCurrentSaveRootDirectory();
File aeBaseFolder = new File( world.getPath() + File.separatorChar + "AE2" );
File aeBaseFolder = new File( world.getPath(), "AE2" );
if ( !aeBaseFolder.isDirectory() && !aeBaseFolder.mkdir() )
{
@ -161,7 +161,7 @@ public class WorldSettings extends Configuration
throw new RuntimeException( "Invalid Request" );
NBTTagCompound data = null;
File file = new File( this.aeFolder, SPAWNDATA_FOLDER + File.separatorChar + dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
File file = new File( this.spawnDataFolder, dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
if ( file.isFile() )
{
@ -227,7 +227,7 @@ public class WorldSettings extends Configuration
if ( !Thread.holdsLock( WorldSettings.class ) )
throw new RuntimeException( "Invalid Request" );
File file = new File( this.aeFolder, SPAWNDATA_FOLDER + File.separatorChar + dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
File file = new File( this.spawnDataFolder, dim + '_' + ( chunkX >> 4 ) + '_' + ( chunkZ >> 4 ) + ".dat" );
FileOutputStream fileOutputStream = null;
try

View file

@ -185,6 +185,6 @@ public class CompassRegion
AELog.info( "Failed to create AE2/compass/" );
}
return new File( folder + File.separatorChar + this.world + '_' + this.low_x + '_' + this.low_z + ".dat" );
return new File( folder, this.world + '_' + this.low_x + '_' + this.low_z + ".dat" );
}
}