mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
Clean up a couple of resources. Also, don't parse jars just because
they're in the mods dir
This commit is contained in:
1 parent
7c7cafbae1
commit
8f9b54a97a
3 files changed
+37
-4
No files matched your search
@@ -14,6 +14,7 @@ package cpw.mods.fml.common.asm;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.ObjectInputStream.GetField;
|
||||
import java.io.StringReader;
|
||||
@@ -135,6 +136,7 @@ public class FMLSanityChecker implements IFMLCallHook
|
||||
// Probably a development environment, or the server (the server is not signed)
|
||||
goodMC = true;
|
||||
}
|
||||
JarFile mcJarFile = null;
|
||||
if (fmlIsJar && !goodMC && codeSource.getLocation().getProtocol().equals("jar"))
|
||||
{
|
||||
try
|
||||
@@ -142,7 +144,7 @@ public class FMLSanityChecker implements IFMLCallHook
|
||||
String mcPath = codeSource.getLocation().getPath().substring(5);
|
||||
mcPath = mcPath.substring(0, mcPath.lastIndexOf('!'));
|
||||
mcPath = URLDecoder.decode(mcPath, Charsets.UTF_8.name());
|
||||
JarFile mcJarFile = new JarFile(mcPath,true);
|
||||
mcJarFile = new JarFile(mcPath,true);
|
||||
mcJarFile.getManifest();
|
||||
JarEntry cbrEntry = mcJarFile.getJarEntry("net/minecraft/client/ClientBrandRetriever.class");
|
||||
ByteStreams.toByteArray(mcJarFile.getInputStream(cbrEntry));
|
||||
@@ -166,6 +168,20 @@ public class FMLSanityChecker implements IFMLCallHook
|
||||
{
|
||||
FMLRelaunchLog.log(Level.SEVERE, e, "A critical error occurred trying to read the minecraft jar file");
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (mcJarFile != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
mcJarFile.close();
|
||||
}
|
||||
catch (IOException ioe)
|
||||
{
|
||||
// Noise
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -85,7 +85,11 @@ public class ModDiscoverer
|
||||
|
||||
for (File modFile : modList)
|
||||
{
|
||||
if (modFile.isDirectory())
|
||||
if (CoreModManager.getLoadedCoremods().contains(modFile.getName()))
|
||||
{
|
||||
FMLLog.finer("Skipping already parsed coremod or tweaker %s", modFile.getName());
|
||||
}
|
||||
else if (modFile.isDirectory())
|
||||
{
|
||||
FMLLog.fine("Found a candidate mod directory %s", modFile.getName());
|
||||
candidates.add(new ModCandidate(modFile, modFile, ContainerType.DIR));
|
||||
|
||||
@@ -160,7 +160,7 @@ public class CoreModManager
|
||||
for (File coreMod : coreModList)
|
||||
{
|
||||
FMLRelaunchLog.fine("Examining for coremod candidacy %s", coreMod.getName());
|
||||
JarFile jar;
|
||||
JarFile jar = null;
|
||||
Attributes mfAttributes;
|
||||
try
|
||||
{
|
||||
@@ -177,7 +177,20 @@ public class CoreModManager
|
||||
FMLRelaunchLog.log(Level.SEVERE, ioe, "Unable to read the jar file %s - ignoring", coreMod.getName());
|
||||
continue;
|
||||
}
|
||||
|
||||
finally
|
||||
{
|
||||
if (jar!=null)
|
||||
{
|
||||
try
|
||||
{
|
||||
jar.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// Noise
|
||||
}
|
||||
}
|
||||
}
|
||||
String cascadedTweaker = mfAttributes.getValue("TweakClass");
|
||||
if (cascadedTweaker != null)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user