Changeset 500 for AE/Installer/trunk
- Timestamp:
- Mar 15, 2010, 12:31:14 AM (15 years ago)
- Location:
- AE/Installer/trunk/source
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/Installer/trunk/source/aeinstallerapp.cpp
r487 r500 19 19 ////@end includes 20 20 21 extern int updateStatus; 22 extern bool installerJustUpdated; 21 23 Install_info_cfg currentAE, updateAE; 22 24 MainWindow* TheWindow; … … 111 113 } 112 114 113 bool installerJustUpdated = false; 114 int updateStatus = GetUpdateStatus(¤tAE, &updateAE, &installerJustUpdated); 115 if (updateStatus) // otherwise there's no update 115 if (updateStatus) // updateStatus was set when MainWindow::CreateControls() was called during initialization of the window 116 116 { 117 117 string updateMsg = "An update for the Anniversary Edition is available.\n"; // for some reason we can't set the initial value while using the '+' operator... 118 118 updateMsg = updateMsg + "Do you wish to update to Edition version " + updateAE.AEVersion + "?\n" + 119 "(Current version is " + currentAE.AEVersion + ")\n"; // ...so tack the rest on in a second command119 "(Current version is " + currentAE.AEVersion + ")\n"; // ...so we tack the rest on in a second command 120 120 wxMessageDialog* updateNotification; 121 121 … … 153 153 "you will be prompted to begin the installation."; 154 154 updateNotification = new wxMessageDialog(TheWindow, updateMsg.c_str(), "AE Installer Alert", wxYES_NO | wxICON_EXCLAMATION, wxDefaultPosition); 155 updateNotification->ShowModal();156 155 if (updateNotification->ShowModal() == wxID_YES) 157 156 { … … 166 165 case UPDATE_INST_REPL_ERR: // the Installer replacement failed, user has to do it :-( 167 166 updateMsg = "The Installer replacement process failed for some reason.\n"; 168 updateMsg = updateMsg + "Please quit, go into the folder Edition/Updates/" + strEUFN + "/install/ and drag the Installer to Edition/install/, " + 169 "replacing the current Installer application, then launch the new version."; 170 updateNotification = new wxMessageDialog(TheWindow, updateMsg.c_str(), "AE Installer Alert", wxOK | wxICON_EXCLAMATION, wxDefaultPosition); 171 updateNotification->ShowModal(); 172 TheWindow->Close(); 167 updateMsg = updateMsg + "In order for the update to continue, go into the folder Edition/updates/" + strEUFN + "/install/ and " + 168 "drag the Installer to Edition/install/, replacing the current Installer application, then launch the " + 169 "new version. Click Yes to quit."; 170 updateNotification = new wxMessageDialog(TheWindow, updateMsg.c_str(), "AE Installer Alert", wxYES_NO | wxICON_EXCLAMATION, wxDefaultPosition); 171 if (updateNotification->ShowModal() == wxID_YES) 172 TheWindow->Close(); 173 173 return true; 174 174 } -
AE/Installer/trunk/source/globals.h
r487 r500 41 41 42 42 #pragma mark DEFINES 43 #define INSTALLER_VERSION "1.1" // only place we need to changethis43 #define INSTALLER_VERSION "1.1" // only place in source we need to set this 44 44 #define UPDATE_LOG_READ_ERR -1 45 45 #define UPDATE_INST_REPL_ERR -2 … … 55 55 { 56 56 bool isInstalled; // replace with function 57 string installerVersion; 57 58 string name; 58 59 string modStringName; -
AE/Installer/trunk/source/installer.cpp
r499 r500 303 303 Tests for presence of prefs with [ -f ] before doing anything so it doesn't create a partial prefs file -- just in case user has never 304 304 run Oni before :-p */ 305 string fullAEpath = escapePath(system_complete(".").parent_path().parent_path().string()); // get full path for edition/305 string fullAEpath = escapePath(system_complete(".").parent_path().parent_path().string()); // get full path for Edition/ (Oni wants the folder that *contains* the GDF) 306 306 char prefsCommand[300] = "[ -f ~/Library/Preferences/com.godgames.oni.plist ] && defaults write com.godgames.oni RetailInstallationPath -string '"; 307 strcat(prefsCommand, fullAEpath.c_str()); // get path of Edition/ folder (Oni wants the folder that *contains* the GDF)307 strcat(prefsCommand, fullAEpath.c_str()); 308 308 strcat(prefsCommand, "'"); // path string is enclosed in single quotes to avoid the need to escape UNIX-unfriendly characters 309 309 system(prefsCommand); … … 327 327 { 328 328 vector<ModPackage> packages; 329 ModPackage package; 329 330 packages.reserve(256); 330 331 fstream file; … … 338 339 file.open((dir_itr->path().string() + "/" + MODINFO_CFG).c_str()); 339 340 340 if(!file.fail()) 341 { 342 //would prefer to push a pointer to a package, but this will do for now 343 packages.push_back(fileToModPackage(file)); 341 if (!file.fail()) 342 { 343 package = fileToModPackage(file); 344 if (package.installerVersion.compare(INSTALLER_VERSION) < 1) // if mod requires newer version of the Installer, we won't add it to the list 345 packages.push_back(package); 344 346 } 345 347 file.close(); … … 368 370 ModPackage package; 369 371 string line; 370 static string NameOfMod = "NameOfMod"; //used for comparing to the current token...371 //I could have done it in reverse (*iter).compare("ModString") or372 static string ARROW = "->"; //did something like "ModString".compare(*iter), and it would have been373 static string ModString = "ModString"; //functionably the same.372 static string AEInstallVersion = "AEInstallVersion"; // used for comparing to the current token... 373 static string NameOfMod = "NameOfMod"; 374 static string ARROW = "->"; 375 static string ModString = "ModString"; 374 376 static string HasOnis = "HasOnis"; 375 377 static string HasDeltas = "HasDeltas"; … … 381 383 static string Category = "Category"; 382 384 static string Creator = "Creator"; 383 while (! file.eof())384 { 385 getline 385 while (!file.eof()) 386 { 387 getline(file,line); 386 388 vector<string> tokens; 387 389 vector<string>::iterator iter; 388 tokenize(line, tokens); //string to vector of "words" 389 if (tokens.capacity() >= 3) { //make sure they are using enough stuff 390 iter = tokens.begin(); //what word we are on, starts at first word 391 /* TODO: Get this "required Installer version" code working 392 if (!AEInstallVersion.compare(*iter)) 393 If mod is too old, skip this mod. 394 */ 395 /*else*/if (!NameOfMod.compare(*iter)) { //if it contains the name 396 for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { // iterates through the words, ends if it reaches the end of the line or a "//" comment 397 if (ARROW.compare(*iter) && NameOfMod.compare(*iter)) { // ignores "->" and "NameOfMod" 390 tokenize(line, tokens); 391 if (tokens.capacity() >= 3) 392 { 393 iter = tokens.begin(); 394 395 if (!AEInstallVersion.compare(*iter)) 396 { 397 iter++; iter++; 398 package.installerVersion = *iter; 399 } 400 else if (!NameOfMod.compare(*iter)) 401 { 402 for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) // iterates through the words, ends if it reaches the end of the line or a "//" comment 403 { 404 if (ARROW.compare(*iter) && NameOfMod.compare(*iter)) // ignores "->" and "NameOfMod" 398 405 package.name += *iter + " "; 399 } 400 } 401 402 } 403 else if (!ModString.compare(*iter)) { 406 } 407 } 408 else if (!ModString.compare(*iter)) 409 { 404 410 iter++; iter++; 405 411 package.modStringName = *iter; … … 407 413 package.modStringVersion = atoi((*iter).c_str()); 408 414 } 409 else if (!HasOnis.compare(*iter)) { 415 else if (!HasOnis.compare(*iter)) 416 { 410 417 iter++; iter++; 411 if ( 418 if (boost::iequals(*iter, "Yes")) package.hasOnis = 1; 412 419 } 413 else if (!HasBSL.compare(*iter)) { 414 if(toupper((*iter)[0]) == 'Y' && toupper((*iter)[1]) == 'E' && toupper((*iter)[2]) == 'S') package.hasBSL = true; 415 else if ( boost::iequals(*iter, "Addon")) package.hasAddon = true; 416 } 417 else if (!HasDeltas.compare(*iter)) { 420 else if (!HasBSL.compare(*iter)) 421 { 422 iter++; iter++; 423 if (toupper((*iter)[0]) == 'Y' && toupper((*iter)[1]) == 'E' && toupper((*iter)[2]) == 'S') package.hasBSL = true; 424 else if (boost::iequals(*iter, "Addon")) package.hasAddon = true; 425 } 426 else if (!HasDeltas.compare(*iter)) 427 { 418 428 iter++; iter++; 419 if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasDeltas = 1; 420 } 421 else if (!HasDats.compare(*iter)) { 429 if (toupper((*iter)[0]) == 'Y' && toupper((*iter)[1]) == 'E' && toupper((*iter)[2]) == 'S') package.hasDeltas = 1; 430 } 431 else if (!HasDats.compare(*iter)) 432 { 422 433 iter++; iter++; 423 if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.hasDats = 1; 424 } 425 else if (!IsEngine.compare(*iter)) { 434 if (toupper((*iter)[0]) == 'Y' && toupper((*iter)[1]) == 'E' && toupper((*iter)[2]) == 'S') package.hasDats = 1; 435 } 436 else if (!IsEngine.compare(*iter)) 437 { 426 438 iter++; iter++; 427 if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.isEngine = 1; 428 } 429 else if (!GlobalNeeded.compare(*iter)) { 439 if (toupper((*iter)[0]) == 'Y' && toupper((*iter)[1]) == 'E' && toupper((*iter)[2]) == 'S') package.isEngine = 1; 440 } 441 else if (!GlobalNeeded.compare(*iter)) 442 { 430 443 iter++; iter++; 431 if (toupper((*iter)[0]) + toupper((*iter)[1]) + toupper((*iter)[2]) == 'Y' + 'E' + 'S') package.globalNeeded = 1; 432 else if (toupper((*iter)[0]) + toupper((*iter)[1]) == 'N' + 'O') package.globalNeeded = 1; // only place where checking for "No" is important atm. 433 } 434 else if (!Category.compare(*iter)) { 435 for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { // iterates through the words, ends if it reaches end of line or a "//" comment 436 if (ARROW.compare(*iter) && Category.compare(*iter)) { // ignores "->" and "Category" 444 if (toupper((*iter)[0]) == 'Y' && toupper((*iter)[1]) == 'E' && toupper((*iter)[2]) == 'S') package.globalNeeded = 1; 445 else if (toupper((*iter)[0]) == 'N' && toupper((*iter)[1]) == 'O') package.globalNeeded = 1; // only place where checking for "No" is important atm 446 } 447 else if (!Category.compare(*iter)) 448 { 449 for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) 450 { 451 if (ARROW.compare(*iter) && Category.compare(*iter)) // ignores "->" and "Category" 437 452 package.category += *iter + " "; 438 } 439 } 440 } 441 else if (!Creator.compare(*iter)) { //if it contains the name 442 for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { // iterates through the words, ends if it reaches end of line or a "//" comment 443 if (ARROW.compare(*iter) && Creator.compare(*iter)) { // ignores "->" and "Creator" 453 } 454 } 455 else if (!Creator.compare(*iter)) 456 { 457 for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) 458 { 459 if (ARROW.compare(*iter) && Creator.compare(*iter)) // ignores "->" and "Creator" 444 460 package.creator += *iter + " "; 445 } 446 } 447 } 448 else if (!Readme.compare(*iter)) { //if it contains the name 449 for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) { // iterates through the words, ends if it reaches end of line or a "//" comment 450 if (ARROW.compare(*iter) && Readme.compare(*iter)) { // ignores "->" and "Readme" 451 if(!(*iter).compare("\\n")) package.readme += '\n'; 461 } 462 } 463 else if (!Readme.compare(*iter)) 464 { 465 for ( ; iter !=tokens.end() && SLASHSLASH.compare(*iter); iter++) 466 { 467 if (ARROW.compare(*iter) && Readme.compare(*iter)) // ignores "->" and "Readme" 468 { 469 if (!(*iter).compare("\\n")) package.readme += '\n'; 452 470 else package.readme += *iter + " "; 453 471 } … … 455 473 } 456 474 } 457 458 475 } 459 476 -
AE/Installer/trunk/source/main_window.cpp
r489 r500 45 45 46 46 bool busy = false; 47 int updateStatus; 48 bool installerJustUpdated = false; 47 49 vector<string> globalInstalledMods; 48 50 vector<ModPackage> globalPackages; … … 355 357 ::CoCreateInstance(CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, IID_ITaskbarList, (void **)&pTaskbarList); 356 358 #endif 359 360 updateStatus = GetUpdateStatus(¤tAE, &updateAE, &installerJustUpdated); 357 361 358 362 globalPackages = getPackages(); 359 363 globalInstalledMods = getInstallString(); 360 for (unsigned int i = 0; i < globalPackages.size(); i++) { 364 for (unsigned int i = 0; i < globalPackages.size(); i++) 365 { 361 366 Mods_CheckboxList->Append(globalPackages[i].name.c_str()); 362 if ( binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName )) Mods_CheckboxList->Check(i);367 if (binary_search(globalInstalledMods.begin(), globalInstalledMods.end(), globalPackages[i].modStringName)) Mods_CheckboxList->Check(i); 363 368 } 364 369
Note:
See TracChangeset
for help on using the changeset viewer.