| 349 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 350 |  | if (!file.fail()) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 351 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 352 | < | package = fileToModPackage(file); | 
 
 
 
 
 
 
 
 
 | 352 | > | package = fileToModPackage(file, dir_itr->path().filename()); | 
 
 
 
 
 
 
 
 
 
 
 | 353 |  | if (package.installerVersion.compare(INSTALLER_VERSION) < 1)  // if mod requires newer version of the Installer, we won't add it to the list | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 354 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 355 |  | #ifdef WIN32 | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 373 |  | return packages; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 374 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 375 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 376 | < | ModPackage fileToModPackage(fstream &file) | 
 
 
 
 
 
 
 
 
 | 376 | > | ModPackage fileToModPackage(fstream &file, string modName) | 
 
 
 
 
 
 
 
 
 
 
 | 377 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 378 |  | /* | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 379 |  | This converts a file to a ModPackage struct. | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 383 |  | 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 | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 384 |  | slower than reading a variable. | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 385 |  | */ | 
 
 
 
 
 
 
 
 | 386 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 387 |  | ModPackage package; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 388 |  | string line; | 
 
 
 
 
 
 
 
 
 
 
 | 389 | < | static string AEInstallVersion = "AEInstallVersion"; // used for comparing to the current token... | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 390 | < | static string NameOfMod = "NameOfMod"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 391 | < | static string ARROW = "->"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 392 | < | static string ModString = "ModString"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 393 | < | static string Platform = "Platform"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 394 | < | static string HasOnis = "HasOnis"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 395 | < | static string HasDeltas = "HasDeltas"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 396 | < | static string HasBSL = "HasBSL"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 397 | < | static string HasDats = "HasDats"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 398 | < | static string IsEngine = "IsEngine"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 399 | < | static string Readme = "Readme"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 400 | < | static string GlobalNeeded = "GlobalNeeded"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 401 | < | static string Category = "Category"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 402 | < | static string Creator = "Creator"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 389 | > | const string AEInstallVersion = "AEInstallVersion"; // used for comparing to the current token... | 
 
 
 
 
 | 390 | > | const string NameOfMod = "NameOfMod"; | 
 
 
 
 
 | 391 | > | const string ARROW = "->"; | 
 
 
 
 
 | 392 | > | const string ModString = "ModString"; | 
 
 
 
 
 | 393 | > | const string ModVersion = "ModVersion"; | 
 
 
 
 
 | 394 | > | const string Platform = "Platform"; | 
 
 
 
 
 | 395 | > | const string HasOnis = "HasOnis"; | 
 
 
 
 
 | 396 | > | const string HasDeltas = "HasDeltas"; | 
 
 
 
 
 | 397 | > | const string HasBSL = "HasBSL"; | 
 
 
 
 
 | 398 | > | const string HasDats = "HasDats"; | 
 
 
 
 
 | 399 | > | const string IsEngine = "IsEngine"; | 
 
 
 
 
 | 400 | > | const string Readme = "Readme"; | 
 
 
 
 
 | 401 | > | const string GlobalNeeded = "GlobalNeeded"; | 
 
 
 
 
 | 402 | > | const string Category = "Category"; | 
 
 
 
 
 | 403 | > | const string Creator = "Creator"; | 
 
 
 
 
 | 404 | > | package.modStringName = modName; | 
 
 
 
 
 
 
 
 
 
 
 | 405 |  | while (!file.eof()) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 406 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 407 |  | getline(file,line); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 428 |  | else if (!ModString.compare(*iter)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 429 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 430 |  | iter++; iter++; | 
 
 
 
 
 
 
 
 
 
 
 | 431 | < | package.modStringName = *iter; | 
 
 
 
 
 
 
 
 
 | 431 | > | //package.modStringName = *iter; | 
 
 
 
 
 
 
 
 
 
 
 | 432 |  | iter++; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 433 |  | package.modStringVersion = atof((*iter).c_str()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 434 |  | } | 
 
 
 
 
 
 
 
 | 435 | + | else if (!ModString.compare(*iter)) | 
 
 
 
 
 
 
 
 | 436 | + | { | 
 
 
 
 
 
 
 
 | 437 | + | iter++; iter++; | 
 
 
 
 
 
 
 
 | 438 | + | package.modStringVersion = atof((*iter).c_str()); | 
 
 
 
 
 
 
 
 | 439 | + | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 440 |  | else if (!Platform.compare(*iter)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 441 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 442 |  | iter++; iter++; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 450 |  | else if (!HasBSL.compare(*iter)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 451 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 452 |  | iter++; iter++; | 
 
 
 
 
 
 
 
 
 
 
 | 453 | < | if (toupper((*iter)[0]) == 'Y' && toupper((*iter)[1]) == 'E' && toupper((*iter)[2]) == 'S') package.hasBSL = true; | 
 
 
 
 
 
 
 
 
 | 453 | > | if (boost::iequals(*iter, "Yes")) package.hasBSL = true; | 
 
 
 
 
 
 
 
 
 
 
 | 454 |  | else if (boost::iequals(*iter, "Addon")) package.hasAddon = true; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 455 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 456 |  | else if (!HasDeltas.compare(*iter)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 983 |  | file.open( (install_iter->path().string() + "/Mod_Info.cfg").c_str()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 984 |  | if (!file.fail()) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 985 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 986 | < | ModPackage updatePackage = fileToModPackage(file); | 
 
 
 
 
 
 
 
 
 | 986 | > | ModPackage updatePackage = fileToModPackage(file, install_iter->path().filename()); | 
 
 
 
 
 
 
 
 
 
 
 | 987 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 988 |  | else | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 989 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 995 |  | file.open( ("packages" + install_iter->path().filename() + "/Mod_Info.cfg").c_str()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 996 |  | if (!file.fail()) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 997 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 998 | < | ModPackage installedPackage = fileToModPackage(file); | 
 
 
 
 
 
 
 
 
 | 998 | > | ModPackage installedPackage = fileToModPackage(file, install_iter->path().filename()); | 
 
 
 
 
 
 
 
 
 
 
 | 999 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1000 |  | else | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1001 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1277 |  | void CrawlPackages(string pathToUpdate, string strPathToPackages) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1278 |  | try{ | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1279 |  | directory_iterator end; | 
 
 
 
 
 
 
 
 
 
 
 | 1280 | < | for ( directory_iterator install_iter( pathToUpdate ); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1281 | < | install_iter != end; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1282 | < | ++install_iter ) | 
 
 
 
 
 
 
 
 
 | 1280 | > | for ( directory_iterator update_iter( pathToUpdate ); | 
 
 
 
 
 | 1281 | > | update_iter != end; | 
 
 
 
 
 | 1282 | > | ++update_iter ) | 
 
 
 
 
 
 
 
 
 
 
 | 1283 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1284 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1285 |  | ModPackage installedPackage, updatePackage; | 
 
 
 
 
 
 
 
 
 
 
 | 1286 | < | string updateStr = install_iter->path().string() + "/Mod_Info.cfg"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1287 | < | if ( !boost::iequals(install_iter->path().filename(),"Edition") | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1288 | < | && !boost::iequals(install_iter->path().filename(),"Edition-patch") | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1289 | < | && is_directory( install_iter->path() ) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1290 | < | && exists( install_iter->path().string() + "/Mod_Info.cfg" ) ) | 
 
 
 
 
 
 
 
 
 | 1286 | > | string updateStr = update_iter->path().string() + "/Mod_Info.cfg"; | 
 
 
 
 
 | 1287 | > | if ( !boost::iequals(update_iter->path().filename(),"Edition") | 
 
 
 
 
 | 1288 | > | && !boost::iequals(update_iter->path().filename(),"Edition-patch") | 
 
 
 
 
 | 1289 | > | && is_directory( update_iter->path() ) | 
 
 
 
 
 | 1290 | > | && exists( update_iter->path().string() + "/Mod_Info.cfg" ) ) | 
 
 
 
 
 
 
 
 
 
 
 | 1291 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1292 |  | bool update = 0; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1293 |  | fstream file; | 
 
 
 
 
 
 
 
 
 
 
 | 1294 | < | file.open( (install_iter->path().string() + "/Mod_Info.cfg").c_str()); | 
 
 
 
 
 
 
 
 
 | 1294 | > | file.open( (update_iter->path().string() + "/Mod_Info.cfg").c_str()); | 
 
 
 
 
 
 
 
 
 
 
 | 1295 |  | if (!file.fail()) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1296 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 1297 | < | updatePackage = fileToModPackage(file); | 
 
 
 
 
 
 
 
 
 | 1297 | > | updatePackage = fileToModPackage(file, update_iter->path().filename()); | 
 
 
 
 
 
 
 
 
 
 
 | 1298 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1299 |  | else | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1300 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1301 |  | file.close(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1302 |  | continue; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1303 |  | } | 
 
 
 
 
 
 
 
 
 
 
 | 1304 | < | if(!exists(strPathToPackages + "/" + install_iter->path().filename() + "/Mod_Info.cfg")); | 
 
 
 
 
 
 
 
 
 | 1304 | > | if(!exists(strPathToPackages + "/" + update_iter->path().filename() + "/Mod_Info.cfg")); | 
 
 
 
 
 
 
 
 
 
 
 | 1305 |  | file.close(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1306 |  | file.clear(); | 
 
 
 
 
 
 
 
 
 
 
 | 1307 | < | file.open((strPathToPackages + "/" + install_iter->path().filename() + "/Mod_Info.cfg").c_str()); | 
 
 
 
 
 
 
 
 
 | 1307 | > | file.open((strPathToPackages + "/" + update_iter->path().filename() + "/Mod_Info.cfg").c_str()); | 
 
 
 
 
 
 
 
 
 
 
 | 1308 |  | if (!file.fail()) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1309 |  | { | 
 
 
 
 
 
 
 
 
 
 
 | 1310 | < | installedPackage = fileToModPackage(file); | 
 
 
 
 
 
 
 
 
 | 1310 | > | installedPackage = fileToModPackage(file, update_iter->path().filename()); | 
 
 
 
 
 
 
 
 
 
 
 | 1311 |  | file.close(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1312 |  | if(updatePackage.modStringVersion > installedPackage.modStringVersion) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1313 |  | remove_all((path)(strPathToPackages +  "/" + installedPackage.modStringName)); |