--- AE/Installer/trunk/source/installer.cpp 2010/05/30 17:28:34 562 +++ AE/Installer/trunk/source/installer.cpp 2010/07/21 22:44:28 570 @@ -24,7 +24,6 @@ using namespace boost::gregorian; using namespace boost::posix_time; -// externs declared in installer.h string strInstallCfg = "../GameDataFolder/Add.cfg"; string strEUFN = "Edition"; // GetUpdateStatus() may set this to "Edition-patch" later, but this is the assumed name of the new Edition folder in Updates/ extern MainWindow* TheWindow; @@ -348,7 +347,8 @@ vector getPackages(string pa if (!file.fail()) { package = fileToModPackage(file, dir_itr->path().filename()); - if (package.installerVersion.compare(INSTALLER_VERSION) < 1) // if mod requires newer version of the Installer, we won't add it to the list + + if (package.installerVersion.compare(gInstallerVersion) < 1) // if mod requires newer version of the Installer, we won't add it to the list { #ifdef WIN32 if (!package.platform.compare("Windows") || !package.platform.compare("Both")) // don't show package if it's not for the right OS @@ -374,7 +374,6 @@ vector getPackages(string pa ModPackage fileToModPackage(fstream &file, string modName) { ModPackage package; - string line; const string AEInstallVersion = "AEInstallVersion"; // used for comparing to the current token... const string NameOfMod = "NameOfMod"; const string ARROW = "->"; @@ -392,14 +391,17 @@ ModPackage fileToModPackage(fstream &fil const string Creator = "Creator"; while (!file.eof()) { - getline(file,line); - vector tokens; + string line; + getline(file, line); + vector tokens; vector::iterator iter; tokenize(line, tokens); if (tokens.capacity() >= 3) { + for (int a = 0; a < tokens.size(); a++) + StripNewlines(&tokens.at(a)); iter = tokens.begin(); - + if (!AEInstallVersion.compare(*iter)) { iter++; iter++; @@ -674,7 +676,7 @@ void recompileAll(vector install 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 - if(globalPackages[j].hasBSL) break; //skip non-BSL + if(!globalPackages[j].hasBSL) break; //skip non-BSL if( exists( "packages/" + globalPackages[j].modStringName + "/BSL/" ) ) { copyBSL("packages/" + globalPackages[j].modStringName + "/BSL", BSLfolders, globalPackages[j] ); BSLlog << "Copied " << globalPackages[j].modStringName << "!\n"; @@ -941,8 +943,7 @@ int GetUpdateStatus(Install_info_cfg *cu else if (readingInstallerVersion && tokens.capacity() >= 3) { readingInstallerVersion = false; - string installerVersion = INSTALLER_VERSION; - if (installerVersion.compare(*iter)) // then the shell script-powered replacement failed + if (gInstallerVersion.compare(*iter)) // then the shell script-powered replacement failed return UPDATE_INST_REPL_ERR; else { @@ -956,7 +957,7 @@ int GetUpdateStatus(Install_info_cfg *cu // Write over old log with updated information ptime startTime(second_clock::local_time()); string strStartTime = to_simple_string(startTime); - string newUpdateLine = installerVersion + " on " + strStartTime; + string newUpdateLine = gInstallerVersion + " on " + strStartTime; for (int a = 0; a < lines.capacity() - 2; a++) // if there were even lines in the log before this at all { newUpdateLog << lines[a].c_str(); @@ -986,8 +987,7 @@ int GetUpdateStatus(Install_info_cfg *cu if (updateAE->AEVersion.compare(currentAE->AEVersion) > 0) // is the release update newer than what's installed? { string strNewInstallerPath = "../updates/" + strEUFN + "/install/" + strInstallerName; - string installerVersion = INSTALLER_VERSION; - if (updateAE->InstallerVersion.compare(installerVersion) >= 1) + if (updateAE->InstallerVersion.compare(gInstallerVersion) >= 1) { if (exists(strNewInstallerPath)) return UPDATE_INST_AVAIL; @@ -1029,7 +1029,7 @@ int GetUpdateStatus(Install_info_cfg *cu file.close(); if (updatePackage.modStringVersion > installedPackage.modStringVersion) { - if (updatePackage.installerVersion <= INSTALLER_VERSION) + if (updatePackage.installerVersion.compare(gInstallerVersion) < 1) return UPDATE_PKG_AVAIL; } } @@ -1616,7 +1616,7 @@ void ProcessPackageUpdates(string pathTo file.close(); if (updatePackage.modStringVersion > installedPackage.modStringVersion) { - if (updatePackage.installerVersion <= INSTALLER_VERSION) + if (updatePackage.installerVersion.compare(gInstallerVersion) < 1) { if(exists(strPathToPackages + "/" + updatePackage.modStringName)) { #ifdef WIN32 @@ -1689,7 +1689,7 @@ void tokenize(const string& str, vector< /* StripNewlines() gets rids of any linebreaks that come from text returned by getline(); \ | getline() should be stripping those out, but Windows CR/LF files seem to be sneaking | -\ some extra return characters into strings in the ReadInstallInfoCfg() function. */ +\ some extra return characters into strings. */ void StripNewlines(string *theLine) { int deleteFromHere = 0;