Fixed Empty Dungeon Guide Bug

Fixed the bug that caused "How_to_add_dungeons.txt" to be copied as an
empty file. The reason was very subtle. Also moved the file to a
different directory.
This commit is contained in:
SenseiKiwi 2013-06-20 04:47:16 -04:00
parent 58b72b3b5a
commit 248f14971e
3 changed files with 7 additions and 7 deletions

View file

@ -112,7 +112,7 @@ public class DungeonHelper
File file = new File(properties.CustomSchematicDirectory); File file = new File(properties.CustomSchematicDirectory);
if (file.exists() || file.mkdir()) if (file.exists() || file.mkdir())
{ {
copyfile.copyFile("/mods/DimDoors/How_to_add_dungeons.txt", file.getAbsolutePath() + "/How_to_add_dungeons.txt"); copyfile.copyFile("/mods/DimDoors/text/How_to_add_dungeons.txt", file.getAbsolutePath() + "/How_to_add_dungeons.txt");
} }
registerFlipBlocks(); registerFlipBlocks();
importCustomDungeons(properties.CustomSchematicDirectory); importCustomDungeons(properties.CustomSchematicDirectory);

View file

@ -12,10 +12,10 @@ public class copyfile
{ {
try try
{ {
System.out.println("DIMDOORS COPYING FILE TIME"); //Note: For this to work properly, you must use getClass() on an instance of the class,
System.out.println("src: " + ori); //not on the value obtained from .class. That was what caused this code to fail before.
System.out.println("dest: " + dest); //SchematicLoader didn't have this problem because we used instances of it.
InputStream in = (mod_pocketDim.class.getClass().getResourceAsStream(ori)); InputStream in = mod_pocketDim.instance.getClass().getResourceAsStream(ori);
OutputStream out = new FileOutputStream(dest); OutputStream out = new FileOutputStream(dest);
byte[] buf = new byte[1024]; byte[] buf = new byte[1024];
int len; int len;
@ -25,9 +25,9 @@ public class copyfile
in.close(); in.close();
out.close(); out.close();
} }
catch(Exception e) catch (Exception e)
{ {
e.printStackTrace(); System.out.println("Unable to get resource: " + ori);
return false; return false;
} }
return true; return true;