| 597 |
|
else if(splitInstances == false){ |
| 598 |
|
directory_iterator end_iter; |
| 599 |
|
|
| 600 |
< |
for ( directory_iterator dir_itr( vanilla_dir ); |
| 601 |
< |
dir_itr != end_iter; |
| 602 |
< |
++dir_itr ) |
| 603 |
< |
{ |
| 604 |
< |
if ( is_directory( dir_itr->status() ) ) |
| 605 |
< |
{ |
| 606 |
< |
numberOfDats++; |
| 600 |
> |
|
| 601 |
> |
char levelnums[256] = {0}; |
| 602 |
> |
|
| 603 |
> |
|
| 604 |
> |
|
| 605 |
> |
for(int k = 0; k < 256; k++) { |
| 606 |
> |
if( exists( (path)("./VanillaDats/level" + lexical_cast<std::string>(k) + "_final/") ) ) { |
| 607 |
> |
levelnums[k] = 1; |
| 608 |
> |
|
| 609 |
|
} |
| 610 |
|
} |
| 611 |
< |
|
| 611 |
> |
|
| 612 |
> |
for (int i = installedMods.size() - 1; i >= 0; i--) { //Iterates through the installed mods (backwards :P) |
| 613 |
> |
for (unsigned int j = 0; j < globalPackages.size(); ++j) { //looking in the global packages |
| 614 |
> |
if (globalPackages[j].modStringName == installedMods[i]) { //for a mod that has BSL in it |
| 615 |
> |
for(int k = 0; k < 256; k++) { |
| 616 |
> |
if( globalPackages[j].hasOnis && |
| 617 |
> |
exists( (path)("packages/" + globalPackages[j].modStringName + "/oni/level" + lexical_cast<std::string>(k) + "_final/") ) ) { |
| 618 |
> |
levelnums[k] = 1; |
| 619 |
> |
|
| 620 |
> |
} |
| 621 |
> |
} |
| 622 |
> |
} |
| 623 |
> |
} |
| 624 |
> |
} |
| 625 |
> |
for (int levelnum = 0; levelnum < 256; levelnum++) |
| 626 |
> |
if (levelnums[levelnum]) |
| 627 |
> |
numberOfDats++; |
| 628 |
> |
|
| 629 |
|
out << numberOfDats; |
| 630 |
|
datString = out.str(); |
| 631 |
< |
|
| 632 |
< |
for ( directory_iterator dir_itr( vanilla_dir ); |
| 614 |
< |
dir_itr != end_iter; |
| 615 |
< |
++dir_itr ) |
| 616 |
< |
{ |
| 631 |
> |
|
| 632 |
> |
for(int levelnum = 0; levelnum < 256; levelnum++) { |
| 633 |
|
try |
| 634 |
|
{ |
| 635 |
< |
if ( is_directory( dir_itr->status() ) ) |
| 635 |
> |
if ( levelnums[levelnum] ) |
| 636 |
|
{ |
| 637 |
< |
importCommand = strOniSplit + " " + strImportOption + " " + vanilla_dir.string() + dir_itr->path().filename() + " "; |
| 637 |
> |
importCommand = strOniSplit + " " + strImportOption + " " + vanilla_dir.string() + "level" + lexical_cast<std::string>(levelnum) + "_Final "; |
| 638 |
|
for (unsigned int i = 0; i < installedMods.size(); ++i) { |
| 639 |
< |
if (exists("packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename() )) |
| 640 |
< |
importCommand += " packages/" + installedMods[i] + "/oni/" + dir_itr->path().filename(); |
| 639 |
> |
if (exists((path)("packages/" + installedMods[i] + "/oni/level" + lexical_cast<std::string>(levelnum) + "_final") )) |
| 640 |
> |
importCommand += " packages/" + installedMods[i] + "/oni/level" + lexical_cast<std::string>(levelnum) + "_Final"; |
| 641 |
|
} |
| 642 |
< |
importCommand += " ../GameDataFolder/" + dir_itr->path().filename() + ".dat >> Install.log"; |
| 642 |
> |
importCommand += " ../GameDataFolder/level" + lexical_cast<std::string>(levelnum) + "_Final.dat >> Install.log"; |
| 643 |
|
|
| 644 |
|
setProgressBar( (int)(1000 * (float)(j-1) / (float)numberOfDats) ); //100% * dat we're on / total dats |
| 645 |
|
setStatusArea("Step " + lexical_cast<std::string>(j) + '/' + lexical_cast<std::string>(numberOfDats)+ ": Importing " + |
| 646 |
< |
dir_itr->path().filename() + " "); |
| 646 |
> |
"level" + lexical_cast<std::string>(levelnum) + "_Final"+ " "); |
| 647 |
|
system(importCommand.c_str()); |
| 648 |
|
j++; |
| 649 |
|
} |
| 663 |
|
vector<string> skippedfolders; |
| 664 |
|
|
| 665 |
|
ofstream BSLlog("BSL.log"); |
| 666 |
+ |
if(exists("../GameDataFolder/BSLBackup/")) { |
| 667 |
+ |
remove_all("../GameDataFolder/BSLBackup/"); |
| 668 |
+ |
} |
| 669 |
+ |
else { |
| 670 |
+ |
create_directory("../GameDataFolder/BSLBackup/"); |
| 671 |
+ |
} |
| 672 |
+ |
copy("../GameDataFolder/IGMD/", "../GameDataFolder/BSLBackup/"); |
| 673 |
|
for ( directory_iterator dir_itr( "../GameDataFolder/IGMD/" ), end_itr; |
| 674 |
|
dir_itr != end_itr; |
| 675 |
|
++dir_itr ) { |
| 682 |
|
for (int i = installedMods.size() - 1; i >= 0; i--) { //Iterates through the installed mods (backwards :P) |
| 683 |
|
for (unsigned int j = 0; j < globalPackages.size(); ++j) { //looking in the global packages |
| 684 |
|
if (globalPackages[j].modStringName == installedMods[i]) { //for a mod that has BSL in it |
| 685 |
< |
if(globalPackages[j].hasBSL)) break; //skip non-BSL |
| 685 |
> |
if(globalPackages[j].hasBSL) break; //skip non-BSL |
| 686 |
|
if( exists( "packages/" + globalPackages[j].modStringName + "/BSL/" ) ) { |
| 687 |
|
copyBSL("packages/" + globalPackages[j].modStringName + "/BSL", BSLfolders, globalPackages[j] ); |
| 688 |
|
BSLlog << "Copied " << globalPackages[j].modStringName << "!\n"; |
| 751 |
|
if ( is_directory( dir_itr->path() ) && dir_itr->path().string() != ".svn" ) { |
| 752 |
|
BSLlog << "Testing " << dir_itr->path().string() << " HasBSL: " << pkg.hasBSL << " HasAddon: " << pkg.hasAddon << "\n"; |
| 753 |
|
int skip_folder = 0; |
| 754 |
< |
if(!pkg.HasAddon) { |
| 754 |
> |
if(!pkg.hasAddon) { |
| 755 |
|
for(unsigned int k = 0; k < BSLfolders.size(); k++) {//iterate through already found BSL folders |
| 756 |
|
BSLlog << "testing " << dir_itr->path().filename() << " vs " << BSLfolders[k] << "\n"; |
| 757 |
|
if(dir_itr->path().filename() == BSLfolders[k]) { |
| 1338 |
|
bool readingVerAndDate = false; |
| 1339 |
|
|
| 1340 |
|
#ifdef WIN32 |
| 1341 |
< |
//string strTrashDir = "Trash\\"; // string unused in Windows because files are simply deleted |
| 1341 |
> |
//remove readonly attrib from files. |
| 1342 |
> |
setStatusArea("Removing readonly attribute..."); |
| 1343 |
> |
system("attrib -r ./* /s"); |
| 1344 |
> |
system("attrib -r ../Oni.exe /s"); |
| 1345 |
> |
system("attrib -r ../binkw32.dll /s"); |
| 1346 |
> |
|
| 1347 |
|
#else |
| 1348 |
|
FILE *fUserName = NULL; |
| 1349 |
|
char chrUserName[32]; |
| 1405 |
|
// Special code to replace our special files -- the Oni app, OniSplit, the Daodan DLL, and the GUI for OniSplit |
| 1406 |
|
if (exists(strPathToEUFN + strOniApp)) |
| 1407 |
|
{ |
| 1408 |
< |
if (exists(strOniApp)) |
| 1408 |
> |
if (exists("../" + strOniApp)) |
| 1409 |
|
#ifdef WIN32 |
| 1410 |
< |
remove((path)strOniApp); |
| 1410 |
> |
remove((path)("../" + strOniApp)); |
| 1411 |
|
#else |
| 1412 |
< |
rename((path)strOniApp, (path)(strTrashDir + strOniApp)); |
| 1412 |
> |
rename((path)("../" + strOniApp), (path)(strTrashDir + strOniApp)); |
| 1413 |
|
#endif |
| 1414 |
< |
rename((path)(strPathToEUFN + strOniApp), (path)strOniApp); |
| 1414 |
> |
rename((path)(strPathToEUFN + strOniApp), (path)("../" + strOniApp)); |
| 1415 |
|
} |
| 1416 |
|
if (updateAE->OniSplitVersion.compare(currentAE->OniSplitVersion) >= 1) |
| 1417 |
|
{ |
| 1534 |
|
|
| 1535 |
|
// Clean up after ourselves, trashing any packages or programs in the update package that are not newer than the current AE |
| 1536 |
|
#ifdef WIN32 |
| 1537 |
< |
remove((path)strPathToEUFN); |
| 1537 |
> |
remove_all((path)strPathToEUFN); |
| 1538 |
|
#else |
| 1539 |
|
create_directory(strTrashDir + "Unneeded update files"); |
| 1540 |
|
rename((path)strPathToEUFN, (path)(strTrashDir + "Unneeded update files/" + strEUFN)); |