package agaricus.mods.Jarmod2Coremod;

import cpw.mods.fml.relauncher.IFMLCallHook;

import java.io.File;
import java.util.Map;

public class Scanner implements IFMLCallHook {

    public File coremodLocation;

    /*
     * Gives the mod coremod data if it wants it.
     */
    @Override
    public void injectData(Map<String, Object> data) {
        if (data.containsKey("coremodLocation")) {
            coremodLocation = (File) data.get("coremodLocation");
        }
    }

    @Override
    public Void call() throws Exception {
        System.out.println("PRELOADING XXX");
        System.out.println("coremodLocation = "+coremodLocation);

        System.exit(0); // for testing
        return null;
    }
}

@@ -32,16 +32,51 @@
 remod;%0A%0A
+import cpw.mods.fml.common.FMLLog;%0A
 import c
@@ -112,16 +112,16 @@
 llHook;%0A
-
 %0Aimport 
@@ -155,16 +155,48 @@
 til.Map;
+%0Aimport java.util.logging.Level;
 %0A%0Apublic
@@ -607,54 +607,142 @@
     
-System.out.println(%22PRELOADING XXX%22
+FMLLog.log(Level.INFO, %22Jarmod2Coremod loading...%22);%0A        //FMLLog.log(Level.INFO, %22coremodLocation = %22+coremodLocation
 );%0A
+%0A
         
 Syst
@@ -741,63 +741,545 @@
     
-System.out.println(%22coremodLocation = %22+coremodLocation
+File root, jarmodsDir;%0A%0A        if (coremodLocation != null) %7B%0A            root = coremodLocation.getParentFile(); // root/coremods/us.jar -%3E root/coremods%0A            if (root != null) %7B%0A                root = root.getParentFile(); // root%0A            %7D%0A        %7D else %7B%0A            root = new File(%22.%22).getCanonicalFile();%0A        %7D%0A%0A        jarmodsDir = new File(root.getCanonicalPath() + System.getProperty(%22file.separator%22) + %22jarmods%22);%0A        jarmodsDir.mkdirs();%0A%0A        FMLLog.log(Level.INFO, %22jarmod directory: %22 + jarmodsDir
 );%0A%0A

Create and locate 'jarmods' directory if it doesn't exist