| 659 |
|
for (int i = installedMods.size() - 1; i >= 0; i--) { //Iterates through the installed mods (backwards :P) |
| 660 |
|
for (unsigned int j = 0; j < globalPackages.size(); ++j) { //looking in the global packages |
| 661 |
|
if (globalPackages[j].modStringName == installedMods[i]) { //for a mod that has BSL in it |
| 662 |
< |
if(!(globalPackages[j].hasAddon || globalPackages[j].hasBSL)) break; //skip non-BSL |
| 662 |
> |
if(globalPackages[j].hasBSL)) break; //skip non-BSL |
| 663 |
|
if( exists( "packages/" + globalPackages[j].modStringName + "/BSL/" ) ) { |
| 664 |
|
copyBSL("packages/" + globalPackages[j].modStringName + "/BSL", BSLfolders, globalPackages[j] ); |
| 665 |
|
BSLlog << "Copied " << globalPackages[j].modStringName << "!\n"; |
| 668 |
|
} |
| 669 |
|
} |
| 670 |
|
|
| 671 |
+ |
|
| 672 |
+ |
|
| 673 |
|
ModPackage emptyPackage; |
| 674 |
|
emptyPackage.modStringName = "VanillaBSL"; |
| 675 |
|
emptyPackage.hasBSL = 1; |
| 676 |
|
copyBSL("packages/VanillaBSL/IGMD", BSLfolders, emptyPackage); |
| 677 |
|
BSLlog.close(); |
| 678 |
< |
|
| 678 |
> |
|
| 679 |
> |
for (int i = installedMods.size() - 1; i >= 0; i--) { //Iterates through the installed mods (backwards :P) |
| 680 |
> |
for (unsigned int j = 0; j < globalPackages.size(); ++j) { //looking in the global packages |
| 681 |
> |
if (globalPackages[j].modStringName == installedMods[i]) { //for a mod that has BSL in it |
| 682 |
> |
if(!globalPackages[j].hasAddon) break; //skip non-BSL |
| 683 |
> |
if( exists( "packages/" + globalPackages[j].modStringName + "/BSL/" ) ) { |
| 684 |
> |
copyBSL("packages/" + globalPackages[j].modStringName + "/BSL", BSLfolders, globalPackages[j] ); |
| 685 |
> |
BSLlog << "Copied " << globalPackages[j].modStringName << "!\n"; |
| 686 |
> |
} |
| 687 |
> |
} |
| 688 |
> |
} |
| 689 |
> |
} |
| 690 |
> |
|
| 691 |
|
logfile << "Writing config file"; |
| 692 |
|
writeInstalledMods(installedMods); |
| 693 |
|
setProgressBar(1000); |
| 728 |
|
if ( is_directory( dir_itr->path() ) && dir_itr->path().string() != ".svn" ) { |
| 729 |
|
BSLlog << "Testing " << dir_itr->path().string() << " HasBSL: " << pkg.hasBSL << " HasAddon: " << pkg.hasAddon << "\n"; |
| 730 |
|
int skip_folder = 0; |
| 731 |
< |
|
| 732 |
< |
for(unsigned int k = 0; k < BSLfolders.size(); k++) {//iterate through already found BSL folders |
| 733 |
< |
BSLlog << "testing " << dir_itr->path().filename() << " vs " << BSLfolders[k] << "\n"; |
| 734 |
< |
if(dir_itr->path().filename() == BSLfolders[k]) { |
| 735 |
< |
skip_folder = 1; |
| 736 |
< |
BSLlog << "skipping " << BSLfolders[k] << " in " << pkg.modStringName << "\n"; |
| 737 |
< |
break; |
| 731 |
> |
if(!pkg.HasAddon) { |
| 732 |
> |
for(unsigned int k = 0; k < BSLfolders.size(); k++) {//iterate through already found BSL folders |
| 733 |
> |
BSLlog << "testing " << dir_itr->path().filename() << " vs " << BSLfolders[k] << "\n"; |
| 734 |
> |
if(dir_itr->path().filename() == BSLfolders[k]) { |
| 735 |
> |
skip_folder = 1; |
| 736 |
> |
BSLlog << "skipping " << BSLfolders[k] << " in " << pkg.modStringName << "\n"; |
| 737 |
> |
break; |
| 738 |
> |
} |
| 739 |
|
} |
| 740 |
|
} |
| 741 |
|
if (!skip_folder && !exists("../GameDataFolder/IGMD/" + dir_itr->path().filename() + "/ignore.txt")) { |
| 750 |
|
copy_file(bsl_itr->path(), "../GameDataFolder/IGMD/" + dir_itr->path().filename() + "/" + bsl_itr->path().filename()); |
| 751 |
|
} |
| 752 |
|
} |
| 753 |
< |
BSLfolders.push_back( dir_itr->path().filename() ); //add back check for addon |
| 754 |
< |
BSLlog << "Pushing " << dir_itr->path().filename() << "\n" ; |
| 753 |
> |
if( !pkg.hasAddon ) { |
| 754 |
> |
BSLfolders.push_back( dir_itr->path().filename() ); //add back check for addon |
| 755 |
> |
BSLlog << "Pushing " << dir_itr->path().filename() << "\n" ; |
| 756 |
> |
} |
| 757 |
|
} |
| 758 |
|
} |
| 759 |
|
} |
| 859 |
|
return UPDATE_LOG_READ_ERR; |
| 860 |
|
} |
| 861 |
|
|
| 862 |
< |
// Is there an update folder, and is it a monthly release or a patch? |
| 862 |
> |
// Is there an update in the updates/ folder, and is it a monthly release or a patch? |
| 863 |
|
bool firstParty = 0; |
| 864 |
+ |
// First create the folder if it's missing, so users are never left wondering where updates are supposed to be put |
| 865 |
+ |
if (!exists("../updates")) |
| 866 |
+ |
create_directory("../updates"); |
| 867 |
|
if (exists("../updates/Edition")) |
| 868 |
|
{ |
| 869 |
|
firstParty = 1; |
| 1289 |
|
|
| 1290 |
|
bool ProcessAEUpdate(Install_info_cfg *currentAE, Install_info_cfg *updateAE, bool *installerJustUpdated) |
| 1291 |
|
{ |
| 1292 |
+ |
try { |
| 1293 |
|
fstream file; |
| 1294 |
|
string line; |
| 1295 |
|
vector<string> tokens, updateStarted; |
| 1309 |
|
string strOniApp = "Oni.exe"; |
| 1310 |
|
#else |
| 1311 |
|
string strOniApp = "Oni.app"; |
| 1291 |
– |
#endif |
| 1312 |
|
bool needNewTrashDir = false; |
| 1313 |
+ |
#endif |
| 1314 |
+ |
|
| 1315 |
|
bool readingVerAndDate = false; |
| 1316 |
|
|
| 1317 |
|
#ifdef WIN32 |
| 1318 |
< |
string strTrashDir = "Trash\\"; // string unused in Windows because files are simply deleted |
| 1318 |
> |
//string strTrashDir = "Trash\\"; // string unused in Windows because files are simply deleted |
| 1319 |
|
#else |
| 1320 |
|
FILE *fUserName = NULL; |
| 1321 |
|
char chrUserName[32]; |
| 1350 |
|
if (readingVerAndDate && tokens.capacity() >= 3) |
| 1351 |
|
tokenize(tokens[2], updateStarted, "-"); |
| 1352 |
|
} |
| 1353 |
+ |
#ifndef WIN32 |
| 1354 |
|
if (updateStarted.capacity() < 3) |
| 1355 |
|
needNewTrashDir = true; |
| 1356 |
|
else |
| 1360 |
|
if (!exists(strTrashDir)) |
| 1361 |
|
needNewTrashDir = true; |
| 1362 |
|
} |
| 1363 |
+ |
#endif |
| 1364 |
|
} |
| 1365 |
|
#ifndef WIN32 |
| 1366 |
|
if (!*installerJustUpdated || needNewTrashDir) // prepare a new directory for deleted files to go to |
| 1378 |
|
if (exists(strPathToEUFN + strOniApp)) |
| 1379 |
|
{ |
| 1380 |
|
if (exists(strOniApp)) |
| 1381 |
+ |
#ifdef WIN32 |
| 1382 |
+ |
remove((path)strOniApp); |
| 1383 |
+ |
#else |
| 1384 |
|
rename((path)strOniApp, (path)(strTrashDir + strOniApp)); |
| 1385 |
+ |
#endif |
| 1386 |
|
rename((path)(strPathToEUFN + strOniApp), (path)strOniApp); |
| 1387 |
|
} |
| 1388 |
|
if (updateAE->OniSplitVersion.compare(currentAE->OniSplitVersion) >= 1) |
| 1390 |
|
if (exists(strPathToEUFNInstall + strOniSplit)) |
| 1391 |
|
{ |
| 1392 |
|
if (exists(strOniSplit)) |
| 1393 |
+ |
#ifdef WIN32 |
| 1394 |
+ |
remove((path)strOniSplit); |
| 1395 |
+ |
#else |
| 1396 |
|
rename((path)strOniSplit, (path)(strTrashDir + strOniSplit)); |
| 1397 |
+ |
#endif |
| 1398 |
|
rename((path)(strPathToEUFNInstall + strOniSplit), (path)strOniSplit); |
| 1399 |
|
} |
| 1400 |
|
} |
| 1404 |
|
if (exists(strPathToEUFN + strDaodan)) |
| 1405 |
|
{ |
| 1406 |
|
if (exists(("../" + strDaodan))) |
| 1407 |
< |
rename((path)("../" + strDaodan), (path)(strTrashDir + strDaodan)); |
| 1407 |
> |
remove((path)("../" + strDaodan)); |
| 1408 |
|
rename((path)(strPathToEUFN + strDaodan), (path)("../" + strDaodan)); |
| 1409 |
|
} |
| 1410 |
|
} |
| 1413 |
|
if (exists(strPathToEUFNInstall + strWinGUI)) |
| 1414 |
|
{ |
| 1415 |
|
if (exists((path)strWinGUI)) |
| 1416 |
< |
rename((path)strWinGUI, (path)(strTrashDir + strWinGUI)); |
| 1416 |
> |
remove((path)strWinGUI); |
| 1417 |
|
if (exists(strWinGUILang)) |
| 1418 |
< |
rename((path)strWinGUILang, (path)(strTrashDir + strWinGUILang)); |
| 1418 |
> |
remove((path)strWinGUILang); |
| 1419 |
|
rename((path)(strPathToEUFNInstall + strWinGUI), (path)strWinGUI); |
| 1420 |
|
rename((path)(strPathToEUFNInstall + strWinGUILang), (path)strWinGUILang); |
| 1421 |
|
} |
| 1448 |
|
while (curPos != string::npos && curPos < thePath.size()) |
| 1449 |
|
{ |
| 1450 |
|
aParentPath = aParentPath + thePath.substr(lastPos, curPos - lastPos); |
| 1451 |
+ |
#ifndef WIN32 |
| 1452 |
|
if (!exists(strTrashDir + aParentPath)) |
| 1453 |
|
create_directory(strTrashDir + aParentPath); |
| 1454 |
+ |
#endif |
| 1455 |
|
lastPos = curPos + 1; |
| 1456 |
|
curPos = thePath.find("/", lastPos); |
| 1457 |
|
aParentPath = aParentPath + "/"; |
| 1496 |
|
for (vector<string>::iterator iter = filesToMove.begin(); iter != filesToMove.end(); iter++) |
| 1497 |
|
{ |
| 1498 |
|
if (exists(strPathToPackages + strGlobalize + *iter)) |
| 1499 |
+ |
#ifdef WIN32 |
| 1500 |
+ |
remove((path)(strPathToPackages + strGlobalize + *iter)); |
| 1501 |
+ |
#else |
| 1502 |
|
rename((path)(strPathToPackages + strGlobalize + *iter), (path)(strTrashDir + *iter)); |
| 1503 |
+ |
#endif |
| 1504 |
|
rename((path)(strPathToEUFNPackages + strGlobalize + *iter), (path)(strPathToPackages + strGlobalize + *iter)); |
| 1505 |
|
} |
| 1506 |
|
|
| 1507 |
|
// Clean up after ourselves, trashing any packages or programs in the update package that are not newer than the current AE |
| 1508 |
+ |
#ifdef WIN32 |
| 1509 |
+ |
remove((path)strPathToEUFN); |
| 1510 |
+ |
#else |
| 1511 |
|
create_directory(strTrashDir + "Unneeded update files"); |
| 1512 |
|
rename((path)strPathToEUFN, (path)(strTrashDir + "Unneeded update files/" + strEUFN)); |
| 1513 |
< |
|
| 1513 |
> |
#endif |
| 1514 |
|
// Write to log that we are finished with update |
| 1515 |
|
ptime end_time(second_clock::local_time()); |
| 1516 |
|
string progressMsg2 = "Edition was updated to:\n" + |
| 1531 |
|
wxCommandEvent e; |
| 1532 |
|
TheWindow->OnRefreshButtonClick( e ); |
| 1533 |
|
return true; |
| 1534 |
+ |
} |
| 1535 |
+ |
catch (exception & ex) |
| 1536 |
+ |
{ |
| 1537 |
+ |
setStatusArea("Warning, handled exception: " + (string)ex.what()); |
| 1538 |
+ |
return false; |
| 1539 |
+ |
} |
| 1540 |
+ |
|
| 1541 |
|
} |
| 1542 |
|
|
| 1543 |
|
void ProcessPackageUpdates(string pathToUpdate, string strPathToPackages) |