Index: /AE/Installer/trunk/source/installer.h
===================================================================
--- /AE/Installer/trunk/source/installer.h	(revision 460)
+++ /AE/Installer/trunk/source/installer.h	(revision 461)
@@ -1,3 +1,3 @@
-#pragma once 
+ #pragma once 
 /* AE/Mod Installer header file */
 #ifndef DOUBLE_HEADER
@@ -26,4 +26,5 @@
 	bool	hasDeltas;
 	bool	hasBSL;
+	bool	hasAddon;
 	bool	hasDats;
 	string	category;
@@ -33,4 +34,5 @@
 	bool	globalNeeded;
 	ModPackage();
+
 	void doOutput()
 	{
@@ -70,4 +72,5 @@
 	hasDeltas = false;
 	hasBSL = false;
+	hasAddon = false;
 	hasDats = false;
 	category = "";
@@ -98,4 +101,6 @@
 void setProgressBar( int );
 
+void copyBSL( string, vector<string>, ModPackage );
+
 //New copy(path, path) function. Too lazy to implement my own, this is basically how I would have done it though.
 //No, really. :)
Index: /AE/Installer/trunk/source/main_window.cpp
===================================================================
--- /AE/Installer/trunk/source/main_window.cpp	(revision 460)
+++ /AE/Installer/trunk/source/main_window.cpp	(revision 461)
@@ -34,4 +34,5 @@
 #include "boost/filesystem.hpp" // includes all needed Boost.Filesystem declarations
 #include "boost/lexical_cast.hpp" //int -> string
+#include "boost/algorithm/string.hpp"
 #include "installer.h"
 
@@ -65,4 +66,6 @@
 
 
+vector<string> globalInstalledMods;
+vector<ModPackage> globalPackages;
 
 
@@ -75,6 +78,6 @@
 	string output;
 	string escape_me = "& ;()|<>\"'\\#*?$";
-	for(int i = 0; i < input.size(); i++)  {
-		for(int j = 0; j < escape_me.size(); j++) if (input[i] == escape_me[j]) output += '\\';
+	for(unsigned int i = 0; i < input.size(); i++)  {
+		for(unsigned int j = 0; j < escape_me.size(); j++) if (input[i] == escape_me[j]) output += '\\';
 		output += input[i];
 	}
@@ -332,5 +335,5 @@
 		create_directory( VanillaAnimations.remove_filename() );
 
-		for(int j = 0; j < GDFPaths.size(); j++) {
+		for(unsigned int j = 0; j < GDFPaths.size(); j++) {
 			logfile << "\tReimporting " << GDFPaths[j].filename() << ".oni\n";
 			setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + ": reimporting " + GDFPaths[j].filename() );
@@ -409,6 +412,5 @@
 	try
 	{
-		directory_iterator end_iter;
-		for (directory_iterator dir_itr("./packages"); dir_itr != end_iter; ++dir_itr)
+		for (directory_iterator dir_itr("./packages"), end_itr; dir_itr != end_itr; ++dir_itr)
 		{
 			file.open((dir_itr->path().string() + "/" + MODINFO_CFG).c_str());
@@ -489,9 +491,10 @@
 			else if (!HasOnis.compare(*iter)) {
 				iter++; iter++;  
-				if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasOnis = 1; //Gotta love c++'s lack of a standard case-insensitive
-				else if (!HasBSL.compare(*iter)) { // string comparer...I know my implementation here sucks. I need to change it to check each character one by one. At the moment,
-					iter++; iter++;}  // using "YFR" would probably set it off. :<
-
-				if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasBSL = 1;
+				if ( boost::iequals(*iter, "Yes")) package.hasOnis = 1;
+			}	
+			else if (!HasBSL.compare(*iter)) { // string comparer...I know my implementation here sucks. I need to change it to check each character one by one. At the moment,
+				iter++; iter++;  // using "YFR" would probably set it off. :<
+				if ( boost::iequals(*iter, "Yes")) package.hasBSL = 1;
+				else if ( boost::iequals(*iter, "Addon")) package.hasAddon = 1;
 			}
 			else if (!HasDeltas.compare(*iter)) {
@@ -519,28 +522,28 @@
 						package.category += *iter + " ";
 					}
+			}
+		}
+		else if (!Creator.compare(*iter))  {	//if it contains the name
+			for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) {	//interates through the words, ends if it reaches the end of the line or a "//" comment
+				if (ARROW.compare(*iter) && Creator.compare(*iter)) {			//ignores "->" and "Category"
+					//cout << *iter; 
+					//cout << " ";
+					package.creator += *iter + " ";
 				}
 			}
-			else if (!Creator.compare(*iter))  {	//if it contains the name
-				for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) {	//interates through the words, ends if it reaches the end of the line or a "//" comment
-					if (ARROW.compare(*iter) && Creator.compare(*iter)) {			//ignores "->" and "Category"
-						//cout << *iter; 
-						//cout << " ";
-						package.creator += *iter + " ";
-					}
+		}
+		else if (!Readme.compare(*iter))  {	//if it contains the name
+			for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) {	//interates through the words, ends if it reaches the end of the line or a "//" comment
+				if (ARROW.compare(*iter) && Readme.compare(*iter)) {			//ignores "->" and "Category"
+					if(!(*iter).compare("\\n")) package.readme += '\n';
+					else package.readme += *iter + " ";
 				}
 			}
-			else if (!Readme.compare(*iter))  {	//if it contains the name
-				for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) {	//interates through the words, ends if it reaches the end of the line or a "//" comment
-					if (ARROW.compare(*iter) && Readme.compare(*iter)) {			//ignores "->" and "Category"
-						if(!(*iter).compare("\\n")) package.readme += '\n';
-						else package.readme += *iter + " ";
-					}
-				}
-			}
-		}
-
-	}
-	package.doOutput();
-	return package;
+		}
+	}
+
+}
+package.doOutput();
+return package;
 }
 
@@ -612,5 +615,5 @@
 					{
 						importCommand = strOniSplit + " " + strImportOption + " " + dir_itr->path().parent_path().string() + '/' + dir_itr->path().filename();
-						for (int i = 0; i < installedMods.size(); ++i) {
+						for (unsigned 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();
@@ -685,5 +688,5 @@
 				{
 					importCommand = strOniSplit + " " + strImportOption + " " + vanilla_dir.string() + dir_itr->path().filename() + " ";
-					for (int i = 0; i < installedMods.size(); ++i) {
+					for (unsigned int i = 0; i < installedMods.size(); ++i) {
 						if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename()  ))
 							importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename();
@@ -712,8 +715,56 @@
 			}}
 	}
+
+
+
+	
+
+
+
+
+		ofstream BSLlog("BSL.log");
+		
+		vector<string> BSLfolders;
+		vector<string> skippedfolders;
+
+		
+
+		for ( directory_iterator dir_itr( "../GameDataFolder/IGMD/" ), end_itr;
+			dir_itr != end_itr;
+			++dir_itr ) {
+				if( exists(dir_itr->path().string() + "/ignore.txt") ){
+					BSLfolders.push_back(dir_itr->path().filename());
+					skippedfolders.push_back(dir_itr->path().filename());
+				}
+		}
+
+		for (int i = installedMods.size() - 1; i >= 0; i--) {							//Iterates through the installed mods (backwards :P)
+			for (unsigned int j = 0; j < globalPackages.size(); ++j) {				//looking in the global packages
+				if (globalPackages[j].modStringName == installedMods[i]) {	//for a mod that has BSL in it
+					BSLlog << "Testing " << globalPackages[j].modStringName << "\n"
+						<< "HasBSL: " << globalPackages[j].hasBSL << "\n"
+						<< "HasAddon: " << globalPackages[j].hasAddon << "\n";
+					if(!(globalPackages[j].hasAddon || globalPackages[j].hasBSL)) break; //skip non-BSL
+					if( exists( "packages/" + globalPackages[j].modStringName + "/BSL" ) )
+					copyBSL("packages/" + globalPackages[j].modStringName + "/BSL", BSLfolders, globalPackages[j] );
+				}
+
+			}
+		}
+
+		ModPackage emptyPackage;
+		copyBSL("packages/VanillaBSL/IGMD", BSLfolders, emptyPackage);
+		BSLlog.close();
+	
+
 	logfile << "Writing config file";
 	writeInstalledMods(installedMods);
 	setProgressBar(1000);
-	setStatusArea("Done! You can now play Oni.");
+	
+	string finallyDone = "Done! You can now play Oni.";
+	
+a
+	
+	setStatusArea(finallyDone);
 
 	ptime end_time(second_clock::local_time());
@@ -724,5 +775,5 @@
 	string outstring = (string)"\n\nGlobalization ended " + to_simple_string(end_time) + "\nThe process took ";// + (string)total_time.length();
 
-	logfile2 << "\nGlobalization ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length();
+	logfile2 << "\nInstallation ended " << to_simple_string(end_time) << "\nThe process took " << total_time.length();
 
 	//logfile2.write(outstring.c_str(), outstring.length());
@@ -733,19 +784,58 @@
 	Sleep(1000);
 	setProgressBar(0);
-	
-}
-			catch(exception & ex) {
-					remove("Install.log");
-					ofstream logfile("Install.log");
-
-
-					logfile << "Warning, exception " << ex.what() << "!";
-					setStatusArea("Warning, exception " + (string)ex.what() + "!");
-					logfile.close();	
-			}
-			busy = 0;
-}
-
-
+
+	}
+	catch(exception & ex) {
+		remove("Install.log"); //why did we do this? :|
+		ofstream logfile("Install.log");
+
+
+		logfile << "Warning, exception " << ex.what() << "!";
+		setStatusArea("Warning, exception " + (string)ex.what() + "!");
+		logfile.close();	
+	}
+	busy = 0;
+}
+
+void copyBSL(string copypath, vector<string> BSLfolders, ModPackage pkg) {
+	try {
+		for ( directory_iterator dir_itr( copypath ), end_itr;
+			dir_itr != end_itr;
+			++dir_itr ) {
+
+				if ( is_directory( dir_itr->path() ) && dir_itr->path().string() != ".svn" ) {  
+					int skip_folder = 0;
+					for(unsigned int k = 0; k < BSLfolders.size(); k++)		{//iterate through already found BSL folders	
+						if(dir_itr->path().filename() == BSLfolders[k]) {
+							skip_folder = 1;			
+							break;
+						}
+					}
+					if (!skip_folder && !exists("../GameDataFolder/IGMD/" + dir_itr->path().filename() + "/ignore.txt")) {
+						remove_all( "../GameDataFolder/IGMD/" + dir_itr->path().filename() );
+						Sleep(100);
+						create_directory( "../GameDataFolder/IGMD/" + dir_itr->path().filename());
+
+						for ( directory_iterator bsl_itr( dir_itr->path() );
+							bsl_itr != end_itr;
+							bsl_itr++ ) {
+								if ( bsl_itr->path().extension() == ".bsl" ) {
+									copy_file(bsl_itr->path(),  "../GameDataFolder/IGMD/" + dir_itr->path().filename() + "/" + bsl_itr->path().filename()); 
+								}
+						}
+						BSLfolders.push_back( dir_itr->path().filename() );
+					}
+				}
+		}
+	}
+	catch ( const std::exception & ex )
+	{
+		setStatusArea("Warning, exception " + (string)ex.what() + "!");
+		while(1) Sleep(1000);
+	}
+
+}
+			 
+			 
 void writeInstalledMods(vector<string> installedMods)
 {
@@ -829,6 +919,4 @@
 }
 
-vector<string> globalInstalledMods;
-vector<ModPackage> globalPackages;
 #include "boost/thread.hpp"
 #include <boost/thread/mutex.hpp>
@@ -1204,5 +1292,5 @@
 	globalPackages = getPackages();
 	globalInstalledMods = getInstallString();
-	for (int i = 0; i < globalPackages.size(); i++) {
+	for (unsigned int i = 0; i < globalPackages.size(); i++) {
 		Mods_CheckboxList->Append(globalPackages[i].name.c_str());
 		if( binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i);
@@ -1243,13 +1331,13 @@
 	switch(SelectAll->Get3StateValue()) {
 	case wxCHK_UNCHECKED:
-		for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false);
+		for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false);
 		//SelectAll->Set3StateValue(wxCHK_CHECKED);
 		break;
 	case wxCHK_CHECKED:
-		for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, true);
+		for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, true);
 		//SelectAll->Set3StateValue(wxCHK_UNCHECKED);
 		break;
 	case wxCHK_UNDETERMINED:
-		for(int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false);
+		for(unsigned int i = 0; i < globalPackages.size(); i++) Mods_CheckboxList->Check(i, false);
 		//SelectAll->Set3StateValue(wxCHK_CHECKED);
 		break;
@@ -1434,5 +1522,5 @@
 	vector<string> localPackages;
 	localPackages.push_back("00000Globalize");
-	for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName );
+	for(unsigned int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) localPackages.push_back( globalPackages[i].modStringName );
 	if ( !localPackages.empty() )	{
 		sort(localPackages.begin(), localPackages.end());
@@ -1576,5 +1664,5 @@
 	Mods_CheckboxList->Clear();
 	//globalInstalledMods = getPackages();
-	for (int i = 0; i < globalPackages.size(); i++) {
+	for (unsigned int i = 0; i < globalPackages.size(); i++) {
 		Mods_CheckboxList->Append(globalPackages[i].name.c_str());
 		if( binary_search(s.begin(), s.end(), globalPackages[i].modStringName ) ) Mods_CheckboxList->Check(i);
@@ -1639,5 +1727,5 @@
 
 		vector<string>list;
-		for(int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName );
+		for(unsigned int i = 0; i < globalPackages.size(); i++) if(Mods_CheckboxList->IsChecked(i)) list.push_back( globalPackages[i].modStringName );
 		vector<string>::iterator begin_iter = list.begin(); 
 		vector<string>::iterator end_iter = list.end();
