package bencvt.mcpacketsniffer.commons;

import java.io.File;

import net.minecraft.src.BaseMod;

/**
 * Get the mod-specific subdirectory: [user's minecraft directory]/mods/[YourModName]/
 * 
 * [YourModName] is the result of BaseMod.getName(), minus the "mod_" prefix.
 * The directory is created if it wasn't there before.
 * 
 * @author bencvt
 * @version 5
 */
public class ModDirectory extends File {
	public ModDirectory(BaseMod mod) {
		this(getModShortName(mod), true);
	}

	public ModDirectory(String pathname, boolean createIfNotExists) {
		super(pathname);
		if (createIfNotExists)
			createIfNotExists();
	}

	public boolean createIfNotExists() {
		if (exists())
			return false;
		mkdirs();
		if (!isDirectory())
			throw new RuntimeException("unable to init mod directory " + getAbsolutePath());
		return true;
	}

	public static String getModShortName(BaseMod mod) {
		String name = mod.getName();
		if (name.startsWith("mod_"))
			name = name.substring(4);
		return name;
	}
}

@@ -56,16 +56,55 @@
 .File;%0A%0A
+import net.minecraft.client.Minecraft;%0A
 import n
@@ -543,21 +543,20 @@
 (String 
-pathn
+modN
 ame, boo
@@ -593,13 +593,95 @@
 per(
-pathn
+Minecraft.getMinecraftDir().getPath() + File.separator + %22mods%22 + File.separator + modN
 ame)

fix directory bug