| 24 |  | using namespace boost::gregorian; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 25 |  | using namespace boost::posix_time; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 26 |  |  | 
 
 
 
 
 
 
 
 
 | 27 | – | // externs declared in installer.h | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 27 |  | string strInstallCfg = "../GameDataFolder/Add.cfg"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 28 |  | string strEUFN = "Edition"; // GetUpdateStatus() may set this to "Edition-patch" later, but this is the assumed name of the new Edition folder in Updates/ | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 29 |  | extern MainWindow* TheWindow; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 347 |  | if (!file.fail()) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 348 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 349 |  | package = fileToModPackage(file, dir_itr->path().filename()); | 
 
 
 
 
 
 
 
 
 
 
 | 350 | < | if (package.installerVersion.compare(INSTALLER_VERSION) < 1)  // if mod requires newer version of the Installer, we won't add it to the list | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 350 | > |  | 
 
 
 
 
 | 351 | > | if (package.installerVersion.compare(gInstallerVersion) < 1)  // if mod requires newer version of the Installer, we won't add it to the list | 
 
 
 
 
 
 
 
 
 
 
 | 352 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 353 |  | #ifdef WIN32 | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 354 |  | if (!package.platform.compare("Windows") || !package.platform.compare("Both")) // don't show package if it's not for the right OS | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 374 |  | ModPackage fileToModPackage(fstream &file, string modName) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 375 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 376 |  | ModPackage package; | 
 
 
 
 
 
 
 
 
 | 377 | – | string line; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 377 |  | const string AEInstallVersion = "AEInstallVersion"; // used for comparing to the current token... | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 378 |  | const string NameOfMod = "NameOfMod"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 379 |  | const string ARROW = "->"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 391 |  | const string Creator = "Creator"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 392 |  | while (!file.eof()) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 393 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 394 | < | getline(file,line); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 395 | < | vector<string> tokens; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 394 | > | string line; | 
 
 
 
 
 | 395 | > | getline(file, line); | 
 
 
 
 
 | 396 | > | vector<string> tokens; | 
 
 
 
 
 
 
 
 
 
 
 | 397 |  | vector<string>::iterator iter; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 398 |  | tokenize(line, tokens); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 399 |  | if (tokens.capacity() >= 3) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 400 |  | { | 
 
 
 
 
 
 
 
 | 401 | + | for (int a = 0; a < tokens.size(); a++) | 
 
 
 
 
 
 
 
 | 402 | + | StripNewlines(&tokens.at(a)); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 403 |  | iter = tokens.begin(); | 
 
 
 
 
 
 
 
 
 
 
 | 404 | < |  | 
 
 
 
 
 
 
 
 
 | 404 | > |  | 
 
 
 
 
 
 
 
 
 
 
 | 405 |  | if (!AEInstallVersion.compare(*iter)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 406 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 407 |  | iter++; iter++; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 943 |  | else if (readingInstallerVersion && tokens.capacity() >= 3) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 944 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 945 |  | readingInstallerVersion = false; | 
 
 
 
 
 
 
 
 
 
 
 | 946 | < | string installerVersion = INSTALLER_VERSION; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 945 | < | if (installerVersion.compare(*iter)) // then the shell script-powered replacement failed | 
 
 
 
 
 
 
 
 
 | 946 | > | if (gInstallerVersion.compare(*iter)) // then the shell script-powered replacement failed | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 947 |  | return UPDATE_INST_REPL_ERR; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 948 |  | else | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 949 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 957 |  | // Write over old log with updated information | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 958 |  | ptime startTime(second_clock::local_time()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 959 |  | string strStartTime = to_simple_string(startTime); | 
 
 
 
 
 
 
 
 
 
 
 | 960 | < | string newUpdateLine = installerVersion + " on " + strStartTime; | 
 
 
 
 
 
 
 
 
 | 960 | > | string newUpdateLine = gInstallerVersion + " on " + strStartTime; | 
 
 
 
 
 
 
 
 
 
 
 | 961 |  | for (int a = 0; a < lines.capacity() - 2; a++) // if there were even lines in the log before this at all | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 962 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 963 |  | newUpdateLog << lines[a].c_str(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 987 |  | if (updateAE->AEVersion.compare(currentAE->AEVersion) > 0) // is the release update newer than what's installed? | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 988 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 989 |  | string strNewInstallerPath = "../updates/" + strEUFN + "/install/" + strInstallerName; | 
 
 
 
 
 
 
 
 
 
 
 | 990 | < | string installerVersion = INSTALLER_VERSION; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 990 | < | if (updateAE->InstallerVersion.compare(installerVersion) >= 1) | 
 
 
 
 
 
 
 
 
 | 990 | > | if (updateAE->InstallerVersion.compare(gInstallerVersion) >= 1) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 991 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 992 |  | if (exists(strNewInstallerPath)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 993 |  | return UPDATE_INST_AVAIL; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1029 |  | file.close(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1030 |  | if (updatePackage.modStringVersion > installedPackage.modStringVersion) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1031 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 1032 | < | if (updatePackage.installerVersion <= INSTALLER_VERSION) | 
 
 
 
 
 
 
 
 
 | 1032 | > | if (updatePackage.installerVersion.compare(gInstallerVersion) < 1) | 
 
 
 
 
 
 
 
 
 
 
 | 1033 |  | return UPDATE_PKG_AVAIL; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1034 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1035 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1616 |  | file.close(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1617 |  | if (updatePackage.modStringVersion > installedPackage.modStringVersion) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1618 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 1619 | < | if (updatePackage.installerVersion <= INSTALLER_VERSION) | 
 
 
 
 
 
 
 
 
 | 1619 | > | if (updatePackage.installerVersion.compare(gInstallerVersion) < 1) | 
 
 
 
 
 
 
 
 
 
 
 | 1620 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1621 |  | if(exists(strPathToPackages +  "/" + updatePackage.modStringName)) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1622 |  | #ifdef WIN32 | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1689 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1690 |  | /* StripNewlines() gets rids of any linebreaks that come from text returned by getline(); \ | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1691 |  | |  getline() should be stripping those out, but Windows CR/LF files seem to be sneaking   | | 
 
 
 
 
 
 
 
 
 
 
 | 1692 | < | \  some extra return characters into strings in the ReadInstallInfoCfg() function.               */ | 
 
 
 
 
 
 
 
 
 | 1692 | > | \  some extra return characters into strings.                                                                                    */ | 
 
 
 
 
 
 
 
 
 
 
 | 1693 |  | void StripNewlines(string *theLine) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1694 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1695 |  | int deleteFromHere = 0; |