From 0b86887962c5aceca9cc43bf5f0c1694e19bd4d0 Mon Sep 17 00:00:00 2001 From: thatsIch Date: Thu, 26 Mar 2015 18:20:49 +0100 Subject: [PATCH] Completes #854 Use superior file constructor to not care about file separator --- src/main/java/appeng/core/WorldSettings.java | 12 ++++++------ .../java/appeng/services/compass/CompassRegion.java | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/appeng/core/WorldSettings.java b/src/main/java/appeng/core/WorldSettings.java index 8917c126..05f3df43 100644 --- a/src/main/java/appeng/core/WorldSettings.java +++ b/src/main/java/appeng/core/WorldSettings.java @@ -61,7 +61,7 @@ public class WorldSettings extends Configuration private static WorldSettings instance; private final List storageCellDims = new ArrayList(); - private final File aeFolder; + private final File spawnDataFolder; private final CompassService compass; private final PlayerMappings mappings; private final Map> loadedStorage = new WeakHashMap>(); @@ -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 diff --git a/src/main/java/appeng/services/compass/CompassRegion.java b/src/main/java/appeng/services/compass/CompassRegion.java index 4de52943..ba87b0ec 100644 --- a/src/main/java/appeng/services/compass/CompassRegion.java +++ b/src/main/java/appeng/services/compass/CompassRegion.java @@ -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" ); } }