// Path: src/main/java/com/github/lunatrius/core/reference/Reference.java
// public class Reference {
//     public static final String MODID = "lunatriuscore";
//     public static final String NAME = "LunatriusCore";
//     public static final String VERSION = "${version}";
//     public static final String FORGE = "${forgeversion}";
//     public static final String MINECRAFT = "${mcversion}";
//     public static final String PROXY_SERVER = "com.github.lunatrius.core.proxy.ServerProxy";
//     public static final String PROXY_CLIENT = "com.github.lunatrius.core.proxy.ClientProxy";
// 
//     public static Logger logger = LogManager.getLogger(Reference.MODID);
// }


import com.github.lunatrius.core.reference.Reference;
import java.io.File;
import java.io.IOException;
package com.github.lunatrius.core.util;



public class FileUtils {
    // http://stackoverflow.com/a/3758880/1166946
    public static String humanReadableByteCount(final long bytes) {
        final int unit = 1024;
        if (bytes < unit) {
            return bytes + " B";
        }

        final int exp = (int) (Math.log(bytes) / Math.log(unit));
        final String pre = "KMGTPE".charAt(exp - 1) + "i";

        return String.format("%3.0f %sB", bytes / Math.pow(unit, exp), pre);
    }

    public static boolean contains(final File root, final String filename) {
        return contains(root, new File(root, filename));
    }

    // http://stackoverflow.com/q/18227634/1166946
    public static boolean contains(final File root, final File file) {
        try {
            return file.getCanonicalPath().startsWith(root.getCanonicalPath() + File.separator);
        } catch (final IOException e) {
// Path: src/main/java/com/github/lunatrius/core/reference/Reference.java
// public class Reference {
//     public static final String MODID = "lunatriuscore";
//     public static final String NAME = "LunatriusCore";
//     public static final String VERSION = "${version}";
//     public static final String FORGE = "${forgeversion}";
//     public static final String MINECRAFT = "${mcversion}";
//     public static final String PROXY_SERVER = "com.github.lunatrius.core.proxy.ServerProxy";
//     public static final String PROXY_CLIENT = "com.github.lunatrius.core.proxy.ClientProxy";
// 
//     public static Logger logger = LogManager.getLogger(Reference.MODID);
// }


// Path: src/main/java/com/github/lunatrius/core/util/FileUtils.java
import com.github.lunatrius.core.reference.Reference;
import java.io.File;
import java.io.IOException;

package com.github.lunatrius.core.util;



public class FileUtils {
    // http://stackoverflow.com/a/3758880/1166946
    public static String humanReadableByteCount(final long bytes) {
        final int unit = 1024;
        if (bytes < unit) {
            return bytes + " B";
        }

        final int exp = (int) (Math.log(bytes) / Math.log(unit));
        final String pre = "KMGTPE".charAt(exp - 1) + "i";

        return String.format("%3.0f %sB", bytes / Math.pow(unit, exp), pre);
    }

    public static boolean contains(final File root, final String filename) {
        return contains(root, new File(root, filename));
    }

    // http://stackoverflow.com/q/18227634/1166946
    public static boolean contains(final File root, final File file) {
        try {
            return file.getCanonicalPath().startsWith(root.getCanonicalPath() + File.separator);
        } catch (final IOException e) {
            Reference.logger.error("", e);