Index: AE/installer2/src/net/oni2/aeinstaller/AEInstaller.properties
===================================================================
--- AE/installer2/src/net/oni2/aeinstaller/AEInstaller.properties	(revision 597)
+++ AE/installer2/src/net/oni2/aeinstaller/AEInstaller.properties	(revision 598)
@@ -1,4 +1,4 @@
 appname=AE Installer 2
-appversion=0.33
+appversion=0.40
 
 invalidPath.title=Wrong directory
Index: AE/installer2/src/net/oni2/aeinstaller/AEInstaller2.java
===================================================================
--- AE/installer2/src/net/oni2/aeinstaller/AEInstaller2.java	(revision 597)
+++ AE/installer2/src/net/oni2/aeinstaller/AEInstaller2.java	(revision 598)
@@ -8,4 +8,5 @@
 import java.net.URL;
 import java.util.ResourceBundle;
+import java.util.TreeSet;
 
 import javax.imageio.ImageIO;
@@ -22,4 +23,5 @@
 import net.oni2.aeinstaller.backend.StuffToRefactorLater;
 import net.oni2.aeinstaller.backend.depot.DepotManager;
+import net.oni2.aeinstaller.backend.mods.Mod;
 import net.oni2.aeinstaller.backend.oni.Installer;
 import net.oni2.aeinstaller.backend.oni.OniSplit;
@@ -143,5 +145,6 @@
 			}
 		} else {
-			Installer.initializeEdition();
+//			Installer.initializeEdition();
+			Installer.install(new TreeSet<Mod>());
 		}
 
Index: AE/installer2/src/net/oni2/aeinstaller/backend/Paths.java
===================================================================
--- AE/installer2/src/net/oni2/aeinstaller/backend/Paths.java	(revision 597)
+++ AE/installer2/src/net/oni2/aeinstaller/backend/Paths.java	(revision 598)
@@ -51,5 +51,5 @@
 	 */
 	public static File getModsPath() {
-		return new File(getInstallerPath(), "mods");
+		return new File(getInstallerPath(), "packages");
 	}
 
Index: AE/installer2/src/net/oni2/aeinstaller/backend/mods/Mod.java
===================================================================
--- AE/installer2/src/net/oni2/aeinstaller/backend/mods/Mod.java	(revision 598)
+++ AE/installer2/src/net/oni2/aeinstaller/backend/mods/Mod.java	(revision 598)
@@ -0,0 +1,44 @@
+package net.oni2.aeinstaller.backend.mods;
+
+import java.io.File;
+
+/**
+ * @author Christian Illy
+ */
+public class Mod implements Comparable<Mod> {
+	private double aeVersion;
+	private int node;
+	private int packageNumber;
+
+	public double getAEVersion() {
+		return aeVersion;
+	}
+
+	public boolean hasSeparatePlatformDirs() {
+		return aeVersion >= 2;
+	}
+
+	public File getLocalPath() {
+		// TODO
+		return null;
+	}
+	
+	public boolean newerAvailable() {
+		//TODO
+		return false;
+	}
+	
+	public boolean localAvailable() {
+		//TODO
+		return false;
+	}
+	
+	public int getPackageNumber() {
+		return packageNumber;
+	}
+
+	@Override
+	public int compareTo(Mod o) {
+		return getPackageNumber() - o.getPackageNumber();
+	}
+}
Index: AE/installer2/src/net/oni2/aeinstaller/backend/oni/Installer.java
===================================================================
--- AE/installer2/src/net/oni2/aeinstaller/backend/oni/Installer.java	(revision 597)
+++ AE/installer2/src/net/oni2/aeinstaller/backend/oni/Installer.java	(revision 598)
@@ -5,9 +5,14 @@
 import java.io.FilenameFilter;
 import java.io.IOException;
+import java.util.HashMap;
+import java.util.List;
 import java.util.Scanner;
+import java.util.TreeSet;
+import java.util.Vector;
 
 import net.oni2.aeinstaller.backend.Paths;
 import net.oni2.aeinstaller.backend.Settings;
 import net.oni2.aeinstaller.backend.Settings.Platform;
+import net.oni2.aeinstaller.backend.mods.Mod;
 
 import org.apache.commons.io.FileUtils;
@@ -30,4 +35,70 @@
 	}
 
+	public static void install(TreeSet<Mod> mods) {
+		Vector<File> folders = new Vector<File>();
+		folders.add(Paths.getVanillaOnisPath());
+
+		for (Mod m : mods) {
+			File oni = new File(m.getLocalPath(), "oni");
+			if (oni.exists()) {
+				if (m.hasSeparatePlatformDirs()) {
+					File oniCommon = new File(oni, "common");
+					File oniMac = new File(oni, "mac_only");
+					File oniWin = new File(oni, "win_only");
+					if (oniCommon.exists())
+						folders.add(oniCommon);
+					if (Settings.getPlatform() == Platform.MACOS
+							&& oniMac.exists())
+						folders.add(oniMac);
+					else if (oniWin.exists())
+						folders.add(oniWin);
+				} else {
+					folders.add(oni);
+				}
+			}
+		}
+
+		for (File f : Paths.getModsPath().listFiles()) {
+			File oni = new File(f, "oni");
+			if (oni.exists())
+				folders.add(oni);
+		}
+		combineBinaryFiles(folders);
+
+		// TODO: bsl()
+	}
+
+	private static void combineBinaryFiles(List<File> srcFolders) {
+		try {
+			createEmptyPath(Paths.getEditionGDF());
+			HashMap<String, Vector<File>> levels = new HashMap<String, Vector<File>>();
+
+			for (File path : srcFolders) {
+				for (File levelF : path.listFiles()) {
+					if (!levels.containsKey(levelF.getName().toLowerCase()))
+						levels.put(levelF.getName().toLowerCase(),
+								new Vector<File>());
+					levels.get(levelF.getName().toLowerCase()).add(levelF);
+				}
+			}
+
+			for (String l : levels.keySet()) {
+				System.out.println("Level " + l);
+				for (File f : levels.get(l)) {
+					System.out.println("    " + f.getPath());
+
+				}
+
+				OniSplit.importLevel(levels.get(l),
+						new File(Paths.getEditionGDF(), l + ".dat"));
+
+				System.out.println();
+			}
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
 	/**
 	 * Initializes the Edition core
@@ -36,5 +107,4 @@
 		File init = new File(Paths.getTempPath(), "init");
 		try {
-			createEmptyPath(Paths.getEditionGDF());
 			createEmptyPath(Paths.getVanillaOnisPath());
 			createEmptyPath(init);
@@ -75,5 +145,8 @@
 				vanillaFolder.mkdirs();
 
-				OniSplit.importLevel(f, new File(vanillaFolder, levelName
+				Vector<File> folders = new Vector<File>();
+				folders.add(f);
+
+				OniSplit.importLevel(folders, new File(vanillaFolder, levelName
 						+ ".oni"));
 			}
@@ -93,22 +166,4 @@
 				FileUtils.copyFile(keyConfVanilla, keyConfEdition);
 
-			if (Settings.getPlatform() == Platform.MACOS) {
-				// TODO
-				// /* On Mac only, set the current GDF to the AE GDF by writing
-				// to Oni's global preferences file (thankfully a standard OS X
-				// ".plist" XML file).
-				// Tests for presence of prefs with [ -f ] before doing anything
-				// so it doesn't create a partial prefs file -- just in case
-				// user has never
-				// run Oni before :-p */
-				// string fullAEpath =
-				// escapePath(system_complete(".").parent_path().parent_path().string());
-				// // get full path for Edition/ (Oni wants folder that
-				// *contains* the GDF)
-				// string prefsCommand =
-				// "[ -f ~/Library/Preferences/com.godgames.oni.plist ] && defaults write com.godgames.oni RetailInstallationPath -string '"
-				// + fullAEpath + "'";
-				// system(prefsCommand.c_str());
-			}
 			// TODO: FileUtils.deleteDirectory(init);
 		} catch (IOException e) {
@@ -175,11 +230,5 @@
 				// TODO ? new File(tempFolder, "TexFix").mkdir();
 				File level0File = new File(level0Folder, f.getName());
-				// TODO: delete non-moved?
-				if (!level0File.exists()) {
-					if (!f.renameTo(level0File)) {
-						System.err.println("File " + f.getName()
-								+ " not moved!");
-					}
-				}
+				moveFileToTargetOrDelete(f, level0File);
 			}
 			// Move matching files to *VANILLA*/level0_Characters
@@ -191,9 +240,12 @@
 					|| f.getName().startsWith("TRSC")
 					|| f.getName().startsWith("TRAS")) {
-				File level0FolderCharactersVanilla = new File(
-						level0FolderVanilla, "characters");
-				File level0FileVanilla = new File(
-						level0FolderCharactersVanilla, f.getName());
-				moveFileToTargetOrDelete(f, level0FileVanilla);
+				// File level0FolderCharactersVanilla = new File(
+				// level0FolderVanilla, "characters");
+				// File level0FileVanilla = new File(
+				// level0FolderCharactersVanilla, f.getName());
+				// moveFileToTargetOrDelete(f, level0FileVanilla);
+				// TODO: does this work?
+				File level0File = new File(level0Folder, f.getName());
+				moveFileToTargetOrDelete(f, level0File);
 			}
 			// Move matching files to level0_Sounds
@@ -225,7 +277,10 @@
 			// fix for buggy ONWC overriding
 			else if (f.getName().startsWith("ONWC")) {
-				File level0FileVanilla = new File(level0FolderVanilla,
-						f.getName());
-				moveFileToTargetOrDelete(f, level0FileVanilla);
+				// File level0FileVanilla = new File(level0FolderVanilla,
+				// f.getName());
+				// moveFileToTargetOrDelete(f, level0FileVanilla);
+				// TODO: does this work?
+				File level0File = new File(level0Folder, f.getName());
+				moveFileToTargetOrDelete(f, level0File);
 			}
 		}
Index: AE/installer2/src/net/oni2/aeinstaller/backend/oni/OniSplit.java
===================================================================
--- AE/installer2/src/net/oni2/aeinstaller/backend/oni/OniSplit.java	(revision 597)
+++ AE/installer2/src/net/oni2/aeinstaller/backend/oni/OniSplit.java	(revision 598)
@@ -108,11 +108,15 @@
 	/**
 	 * Import given folder to a .dat-file
-	 * @param sourceFolder Folder containing .oni-files
-	 * @param targetFile Target .dat-file
+	 * 
+	 * @param sourceFolders
+	 *            Folders containing .oni-files
+	 * @param targetFile
+	 *            Target .dat-file
 	 */
-	public static void importLevel(File sourceFolder, File targetFile) {
+	public static void importLevel(Vector<File> sourceFolders, File targetFile) {
 		Vector<String> cmdLine = getProgramInvocation();
 		cmdLine.add(getImportParam());
-		cmdLine.add(sourceFolder.getPath());
+		for (File f : sourceFolders)
+			cmdLine.add(f.getPath());
 		cmdLine.add(targetFile.getPath());
 		// System.out.println(cmdLine.toString());
