Changeset 505
- Timestamp:
- Mar 27, 2010, 3:17:32 PM (15 years ago)
- Location:
- AE/Installer/trunk/source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/Installer/trunk/source/installer.cpp
r504 r505 350 350 if (!file.fail()) 351 351 { 352 package = fileToModPackage(file );352 package = fileToModPackage(file, dir_itr->path().filename()); 353 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 354 { … … 374 374 } 375 375 376 ModPackage fileToModPackage(fstream &file )376 ModPackage fileToModPackage(fstream &file, string modName) 377 377 { 378 378 /* … … 384 384 slower than reading a variable. 385 385 */ 386 386 387 ModPackage package; 387 388 string line; 388 static string AEInstallVersion = "AEInstallVersion"; // used for comparing to the current token... 389 static string NameOfMod = "NameOfMod"; 390 static string ARROW = "->"; 391 static string ModString = "ModString"; 392 static string Platform = "Platform"; 393 static string HasOnis = "HasOnis"; 394 static string HasDeltas = "HasDeltas"; 395 static string HasBSL = "HasBSL"; 396 static string HasDats = "HasDats"; 397 static string IsEngine = "IsEngine"; 398 static string Readme = "Readme"; 399 static string GlobalNeeded = "GlobalNeeded"; 400 static string Category = "Category"; 401 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; 402 405 while (!file.eof()) 403 406 { … … 426 429 { 427 430 iter++; iter++; 428 package.modStringName = *iter;431 //package.modStringName = *iter; 429 432 iter++; 433 package.modStringVersion = atof((*iter).c_str()); 434 } 435 else if (!ModString.compare(*iter)) 436 { 437 iter++; iter++; 430 438 package.modStringVersion = atof((*iter).c_str()); 431 439 } … … 443 451 { 444 452 iter++; iter++; 445 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; 446 454 else if (boost::iequals(*iter, "Addon")) package.hasAddon = true; 447 455 } … … 976 984 if (!file.fail()) 977 985 { 978 ModPackage updatePackage = fileToModPackage(file );986 ModPackage updatePackage = fileToModPackage(file, install_iter->path().filename()); 979 987 } 980 988 else … … 988 996 if (!file.fail()) 989 997 { 990 ModPackage installedPackage = fileToModPackage(file );998 ModPackage installedPackage = fileToModPackage(file, install_iter->path().filename()); 991 999 } 992 1000 else … … 1270 1278 try{ 1271 1279 directory_iterator end; 1272 for ( directory_iterator install_iter( pathToUpdate );1273 install_iter != end;1274 ++ install_iter )1280 for ( directory_iterator update_iter( pathToUpdate ); 1281 update_iter != end; 1282 ++update_iter ) 1275 1283 { 1276 1284 1277 1285 ModPackage installedPackage, updatePackage; 1278 string updateStr = install_iter->path().string() + "/Mod_Info.cfg";1279 if ( !boost::iequals( install_iter->path().filename(),"Edition")1280 && !boost::iequals( install_iter->path().filename(),"Edition-patch")1281 && is_directory( install_iter->path() )1282 && 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" ) ) 1283 1291 { 1284 1292 bool update = 0; 1285 1293 fstream file; 1286 file.open( ( install_iter->path().string() + "/Mod_Info.cfg").c_str());1294 file.open( (update_iter->path().string() + "/Mod_Info.cfg").c_str()); 1287 1295 if (!file.fail()) 1288 1296 { 1289 updatePackage = fileToModPackage(file );1297 updatePackage = fileToModPackage(file, update_iter->path().filename()); 1290 1298 } 1291 1299 else … … 1294 1302 continue; 1295 1303 } 1296 if(!exists(strPathToPackages + "/" + install_iter->path().filename() + "/Mod_Info.cfg"));1304 if(!exists(strPathToPackages + "/" + update_iter->path().filename() + "/Mod_Info.cfg")); 1297 1305 file.close(); 1298 1306 file.clear(); 1299 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()); 1300 1308 if (!file.fail()) 1301 1309 { 1302 installedPackage = fileToModPackage(file );1310 installedPackage = fileToModPackage(file, update_iter->path().filename()); 1303 1311 file.close(); 1304 1312 if(updatePackage.modStringVersion > installedPackage.modStringVersion) { -
AE/Installer/trunk/source/installer.h
r499 r505 53 53 int listInstalledPackages(void); 54 54 int printInstallerInfo(void); 55 ModPackage fileToModPackage(fstream& );55 ModPackage fileToModPackage(fstream&, string); 56 56 bool StringIsLegalPathForDeletion(string); 57 57 vector<ModPackage> getPackages(string packageDir = "./packages");
Note:
See TracChangeset
for help on using the changeset viewer.