Index: AE/Installer/trunk/source/methods.h
===================================================================
--- AE/Installer/trunk/source/methods.h	(revision 294)
+++ AE/Installer/trunk/source/methods.h	(revision 298)
@@ -4,5 +4,6 @@
 
 using namespace std;
-
+static string SLASHSLASH = "//";
+static string DIRSLASH = "\\";
 struct ModPackage {
 	bool	isInstalled; //replace with function 
@@ -21,40 +22,41 @@
 	ModPackage();
 	void doOutput() {
-			cout << "Mod: " << name; cout << "\n"; //remove this when done
-			cout << "	String: " << modStringName << " v." << modStringVersion << "\n";
-			cout << "	Category: " << category << "\n";
-			cout << "	Creator: " << creator << "\n";
-			cout << "	HasOnis: " << hasOnis << "\n";
-			cout << "	HasBSL: " << hasBSL << "\n";
-			cout << "	HasDeltas: " << hasDeltas << "\n";
-			cout << "	HasDats: " << hasDats << "\n";
-			cout << "	IsEngine: " << isEngine << "\n";
-			cout << "	GlobalNeeded: " << globalNeeded << "\n";
-			cout << "	Readme: " << readme << "\n";
-			cout << "\n";
-}
+		cout << "Mod: " << name; cout << "\n"; //remove this when done
+		cout << "	String: " << modStringName << " v." << modStringVersion << "\n";
+		cout << "	Category: " << category << "\n";
+		cout << "	Creator: " << creator << "\n";
+		cout << "	HasOnis: " << hasOnis << "\n";
+		cout << "	HasBSL: " << hasBSL << "\n";
+		cout << "	HasDeltas: " << hasDeltas << "\n";
+		cout << "	HasDats: " << hasDats << "\n";
+		cout << "	IsEngine: " << isEngine << "\n";
+		cout << "	GlobalNeeded: " << globalNeeded << "\n";
+		cout << "	Readme: " << readme << "\n";
+		cout << "\n";
+	}
 
 };
 //Initialization
 ModPackage::ModPackage() {
-		isInstalled = 0; //replace with function 
-		name = "";
-		modStringName = "";
-		modStringVersion = 0;
-		hasOnis = 0;
-		hasDeltas = 0;
-		hasBSL = 0;
-		hasDats = 0;
-		category = "";
-		creator = "";
-		isEngine = 0;
-		readme = "";
-		globalNeeded = 1;
-//		void doOutput() const
-//		{ };
+	isInstalled = 1; //replace with function 
+	name = "";
+	modStringName = "";
+	modStringVersion = 0;
+	hasOnis = 0;
+	hasDeltas = 0;
+	hasBSL = 0;
+	hasDats = 0;
+	category = "";
+	creator = "";
+	isEngine = 0;
+	readme = "";
+	globalNeeded = 1;
+	//		void doOutput() const
+	//		{ };
 }
 
 int mainMenu();
 vector<ModPackage> getPackages();
+vector<string> getInstallString();
 ModPackage fileToModPackage(fstream&);
 
@@ -62,8 +64,9 @@
 void uninstallPackages();
 void getInstalledPackages();
+void RecompileAll( vector<string>);
 
 bool getDirectoryContents(char , char &);
 
-
+//stolen token function...
 void Tokenize(const string& str,
 			  vector<string>& tokens,
@@ -85,2 +88,3 @@
 	}
 }
+
Index: AE/Installer/trunk/source/subs.cpp
===================================================================
--- AE/Installer/trunk/source/subs.cpp	(revision 294)
+++ AE/Installer/trunk/source/subs.cpp	(revision 298)
@@ -1,2 +1,3 @@
+#define DEBUG
 /*
 AE\Mod Installer.
@@ -4,7 +5,16 @@
 Needs getPackages() now!
 */
-
+//#include <dir.h>
 #include <string>
-//#include <string.h>
+
+#include <direct.h>
+
+#include "boost/filesystem/operations.hpp"
+#include "boost/filesystem/path.hpp"
+#include "boost/filesystem.hpp"   // includes all needed Boost.Filesystem declarations
+#include <iostream>               // for std::cout
+         // for ease of tutorial presentation;
+                                  //  a namespace alias is preferred practice in real code
+
 #include <cctype>
 #include <iostream>
@@ -13,22 +23,34 @@
 #include <fstream>
 
+
+
 #include <errno.h>
 #ifdef WIN32
-#include "Include\dirent.h"
+	#include "Include\dirent.h"
+	#include <windows.h>
+	static const string Onisplit = "Onisplit.exe";
+	string import = "-import:nosep";
 #else
+#include <stdlib.h>
 #include <dirent.h> //??? is this included for Macs?
+	string import = "-import:sep";
+	static const string Onisplit = "./mono Onisplit.exe";
 #endif
-#include <stdio.h>
-#include <stdlib.h>
-
-
+
+
+
+using namespace boost::filesystem; 
 using namespace std;
-bool FALSE = 0;
-bool TRUE = 0;
-
+//bool FALSE = 0;
+//bool TRUE = 0;
+
+const bool SPLIT = 1;
+const bool NOT_SPLIT = 0;
+
+bool splitInstances = SPLIT;
 
 int main(void)
 {
-
+	
 	//	SetConsoleTitle("AE Installer"); windows junk, convert to SDL
 	//	system("color 0A"); 
@@ -43,13 +65,19 @@
 vector<ModPackage> getPackages(void) {
 	vector<ModPackage> packages;
-	packages.reserve(256); //thats 63 or 64 pointers to packages...i think. :P Reserving this improves performance when we add new pointers
-
+	packages.reserve(65536); //comeon, we shouldn't need this much space...right?!
 	fstream file;
-
+#ifdef DEBUG
 #ifdef WIN32
-	string path = "K:\\Oni\\edition\\install\\packages"; //only for my build. :P
+	string path = ".\\packages"; //only for my build. :P
+	 _chdir(path.c_str());
+
+	 _chdir("..");
+	 cout << path;
 #else
 	string path = "K:\\Oni\\edition\\install\\packages"; //change this, 'scen.
 #endif
+#else
+	string path = ".";
+#endif
 
 	string filename = "\0";
@@ -63,5 +91,5 @@
 	pdir = opendir( path.c_str() ); //"." refers to the current dir
 	if (!pdir){
-		printf ("opendir() failure; terminating");
+		printf ("\nopendir() failure; terminating");
 		exit(1);
 	}
@@ -103,14 +131,14 @@
 ModPackage fileToModPackage(fstream &file) {
 	/*
-		This converts a file to a ModPackage struct.
-
-		A few notes...
-			"iter" is the current word we are on. I should have named it "token" or something, but I don't have multiple iterators, so its ok.
-			I refer to (*iter) at the beginning of each if statement block. I could probably store it as a variable, but I'm pretty sure that dereferencing a pointer\iterator isn't much slower than reading a variable.
+	This converts a file to a ModPackage struct.
+
+	A few notes...
+	"iter" is the current word we are on. I should have named it "token" or something, but I don't have multiple iterators, so its ok.
+	I refer to (*iter) at the beginning of each if statement block. I could probably store it as a variable, but I'm pretty sure that dereferencing a pointer\iterator isn't much slower than reading a variable.
 	*/
 	ModPackage package;
 	string line;
 	static string NameOfMod = "NameOfMod";	//used for comparing to the current token...
-	static string SLASHSLASH = "//";		//I could have done it in reverse (*iter).compare("ModString") or  
+	//I could have done it in reverse (*iter).compare("ModString") or  
 	static string ARROW = "->";				//did something like "ModString".compare(*iter), and it would have been
 	static string ModString = "ModString";	//functionably the same. 
@@ -144,5 +172,5 @@
 					}
 				}
-				
+
 			}
 			else if (!ModString.compare(*iter)) {
@@ -223,5 +251,5 @@
 		ok = TRUE;
 		choice = cin.get();
-		cin.ignore(1);
+		cin.ignore(128, '\n');
 		switch(choice) {
 			case '1':
@@ -247,9 +275,10 @@
 	ModPackage package;
 	vector<string> installed_packages;
-	vector<ModPackage> packages; // = getPackages()
+	vector<ModPackage> packages; 
 	vector<ModPackage>::iterator iter;
 	iter = packages.begin();
-
-	getPackages();
+	vector<string> installString;
+	packages = getPackages();
+	vector<string> installedMods = getInstallString();
 
 	if (packages.empty()) {
@@ -257,26 +286,50 @@
 		return;
 	}
-
 	cout << "Detecting installed packages...\n";
-
-	for(int i = 0; i < packages.size();) {
-		package = *iter;
-		if(!package.isInstalled){
-			packages.erase(iter);
-		}
-		else { 
-			i++;
-			iter++;
-		}
-
-	}
-
-	if (packages.empty()) {
-		cout << "Error: You have no installed packages!\n";
+	
+	int index = 1;
+	char  choice = '0';
+	for (vector<ModPackage>::iterator package_iter = packages.begin(); package_iter != packages.end(); ++package_iter) {
+		if (!binary_search(installedMods.begin(), installedMods.end(), package_iter->modStringName)) { //package_iter->isInstalled :< I forgot about this...
+			//cout << index << " ";
+			system("cls");
+			cout << (*package_iter).name <<"\n";
+			for( int character = 1; character <= (*package_iter).name.length() - 1; character++) cout << char(196); //does extended ASCII work in UNIX? 
+			cout << "\n"
+				<< (*package_iter).readme << "\n"
+				<< "\n"
+				<< "Please enter a number choice\n"
+				<< " 1. Install\n"
+				<< " 2. Don't Install\n"
+				<< "";
+			index++;
+			choice = 0;
+			
+			do {
+			choice = cin.get();
+			cin.ignore(1280, '\n');
+			} while(choice == 0);
+			if (choice == '1') {
+				cout << "\nInstalling...\n\n";
+				if ( package_iter->hasOnis || ( package_iter->hasDeltas /*(*package_iter).isUnpacked */ )) {
+					installedMods.push_back(package_iter->modStringName);				
+						
+						system("PAUSE");
+						
+
+				}
+			}
+
+		}
+	}
+	if (index == 1) {
+		cout << "Error: All packages are already installed\n";
 		return;
 	}
-
-	//listInstalledPackages(packages);
-
+	sort(installedMods.begin(), installedMods.end());
+	 
+	 //system(Onisplit.c_str());
+	RecompileAll(installedMods);
+	 system("PAUSE");
 }
 void uninstallPackages() {
@@ -287,2 +340,86 @@
 	;
 }
+
+void RecompileAll(vector<string> installedMods) {
+	cout << "Recompiling Data...\n";
+	path vanilla_dir = "./packages/VanillaDats/";
+	string importCommand = "";
+	if(splitInstances == SPLIT){
+		recursive_directory_iterator end_iter;
+				try {
+		for ( recursive_directory_iterator dir_itr( vanilla_dir );
+			dir_itr != end_iter;
+			++dir_itr )
+		{
+			try
+			{
+				if ( is_directory( dir_itr->status() ) &&  dir_itr.level() == 1)
+				{
+					importCommand =  Onisplit + " " + import + " " + dir_itr->path().parent_path().string() + '/' + dir_itr->path().filename();
+					for (int i = 0; i < installedMods.size(); ++i) {
+						if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename()  ))
+							importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().parent_path().filename() + '/' + dir_itr->path().filename();
+						
+						//else cout << " packages/VanillaDats/" + installedMods[i] + "/oni/";
+						}
+					importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat";
+						system(importCommand.c_str());
+//cout << importCommand << "\n";
+				}
+			}
+			catch ( const std::exception & ex )
+			{
+				cout << "Warning, exception " << ex.what() << "!";
+			}
+		}
+				}
+				catch( const std::exception & ex ) {
+					cout << "Warning, exception " << ex.what() << "!\n"
+						<< "You probably need to reGlobalize.;
+					create_directory( "./packages/VanillaDats" );
+				}
+
+	}
+	else if(splitInstances == NOT_SPLIT){
+		directory_iterator end_iter;
+		for ( directory_iterator dir_itr( vanilla_dir );
+			dir_itr != end_iter;
+			++dir_itr )
+		{
+			try
+			{
+				if ( is_directory( dir_itr->status() ) )
+				{
+					system((Onisplit + " " + import + " " + vanilla_dir.string() + dir_itr->path().filename() + " " + "../GameDataFolder/" + dir_itr->path().filename() + ".dat").c_str());
+				}
+			}
+			catch ( const std::exception & ex )
+			{
+				cout << "Warning, something odd happened!\n";
+			}
+		}
+
+
+
+	}
+}
+
+vector<string> getInstallString() {
+	system("PAUSE");
+	vector<string> returnval;
+		string file_name = "../GameDataFolder/ImportList.cfg";
+		string line;
+		fstream file;
+		if( exists(file_name) ) {
+			file.open(file_name.c_str());
+			getline (file,line);
+			Tokenize(line, returnval);		
+			file.close();
+			file.clear();
+			sort(returnval.begin(), returnval.end());
+					
+		}
+		else cout << "fail";
+		
+	return returnval;
+}
