| 27 |
|
// externs declared in installer.h |
| 28 |
|
string strInstallCfg = "../GameDataFolder/Add.cfg"; |
| 29 |
|
string strEUFN = "Edition"; // GetUpdateStatus() may set this to "Edition-patch" later, but this is the assumed name of the new Edition folder in Updates/ |
| 30 |
+ |
extern MainWindow* TheWindow; |
| 31 |
|
|
| 32 |
|
int globalizeData(void) |
| 33 |
|
{ |
| 647 |
|
vector<string> skippedfolders; |
| 648 |
|
|
| 649 |
|
ofstream BSLlog("BSL.log"); |
| 650 |
+ |
if(exists("../GameDataFolder/BSLBackup/")) { |
| 651 |
+ |
remove_all("../GameDataFolder/BSLBackup/"); |
| 652 |
+ |
} |
| 653 |
+ |
else { |
| 654 |
+ |
create_directory("../GameDataFolder/BSLBackup/"); |
| 655 |
+ |
} |
| 656 |
+ |
copy("../GameDataFolder/IGMD/", "../GameDataFolder/BSLBackup/"); |
| 657 |
|
for ( directory_iterator dir_itr( "../GameDataFolder/IGMD/" ), end_itr; |
| 658 |
|
dir_itr != end_itr; |
| 659 |
|
++dir_itr ) { |
| 666 |
|
for (int i = installedMods.size() - 1; i >= 0; i--) { //Iterates through the installed mods (backwards :P) |
| 667 |
|
for (unsigned int j = 0; j < globalPackages.size(); ++j) { //looking in the global packages |
| 668 |
|
if (globalPackages[j].modStringName == installedMods[i]) { //for a mod that has BSL in it |
| 669 |
< |
if(!(globalPackages[j].hasAddon || globalPackages[j].hasBSL)) break; //skip non-BSL |
| 669 |
> |
if(globalPackages[j].hasBSL) break; //skip non-BSL |
| 670 |
|
if( exists( "packages/" + globalPackages[j].modStringName + "/BSL/" ) ) { |
| 671 |
|
copyBSL("packages/" + globalPackages[j].modStringName + "/BSL", BSLfolders, globalPackages[j] ); |
| 672 |
|
BSLlog << "Copied " << globalPackages[j].modStringName << "!\n"; |
| 675 |
|
} |
| 676 |
|
} |
| 677 |
|
|
| 678 |
+ |
|
| 679 |
+ |
|
| 680 |
|
ModPackage emptyPackage; |
| 681 |
|
emptyPackage.modStringName = "VanillaBSL"; |
| 682 |
|
emptyPackage.hasBSL = 1; |
| 683 |
|
copyBSL("packages/VanillaBSL/IGMD", BSLfolders, emptyPackage); |
| 684 |
|
BSLlog.close(); |
| 685 |
< |
|
| 685 |
> |
|
| 686 |
> |
for (int i = installedMods.size() - 1; i >= 0; i--) { //Iterates through the installed mods (backwards :P) |
| 687 |
> |
for (unsigned int j = 0; j < globalPackages.size(); ++j) { //looking in the global packages |
| 688 |
> |
if (globalPackages[j].modStringName == installedMods[i]) { //for a mod that has BSL in it |
| 689 |
> |
if(!globalPackages[j].hasAddon) break; //skip non-BSL |
| 690 |
> |
if( exists( "packages/" + globalPackages[j].modStringName + "/BSL/" ) ) { |
| 691 |
> |
copyBSL("packages/" + globalPackages[j].modStringName + "/BSL", BSLfolders, globalPackages[j] ); |
| 692 |
> |
BSLlog << "Copied " << globalPackages[j].modStringName << "!\n"; |
| 693 |
> |
} |
| 694 |
> |
} |
| 695 |
> |
} |
| 696 |
> |
} |
| 697 |
> |
|
| 698 |
|
logfile << "Writing config file"; |
| 699 |
|
writeInstalledMods(installedMods); |
| 700 |
|
setProgressBar(1000); |
| 735 |
|
if ( is_directory( dir_itr->path() ) && dir_itr->path().string() != ".svn" ) { |
| 736 |
|
BSLlog << "Testing " << dir_itr->path().string() << " HasBSL: " << pkg.hasBSL << " HasAddon: " << pkg.hasAddon << "\n"; |
| 737 |
|
int skip_folder = 0; |
| 738 |
< |
|
| 739 |
< |
for(unsigned int k = 0; k < BSLfolders.size(); k++) {//iterate through already found BSL folders |
| 740 |
< |
BSLlog << "testing " << dir_itr->path().filename() << " vs " << BSLfolders[k] << "\n"; |
| 741 |
< |
if(dir_itr->path().filename() == BSLfolders[k]) { |
| 742 |
< |
skip_folder = 1; |
| 743 |
< |
BSLlog << "skipping " << BSLfolders[k] << " in " << pkg.modStringName << "\n"; |
| 744 |
< |
break; |
| 738 |
> |
if(!pkg.hasAddon) { |
| 739 |
> |
for(unsigned int k = 0; k < BSLfolders.size(); k++) {//iterate through already found BSL folders |
| 740 |
> |
BSLlog << "testing " << dir_itr->path().filename() << " vs " << BSLfolders[k] << "\n"; |
| 741 |
> |
if(dir_itr->path().filename() == BSLfolders[k]) { |
| 742 |
> |
skip_folder = 1; |
| 743 |
> |
BSLlog << "skipping " << BSLfolders[k] << " in " << pkg.modStringName << "\n"; |
| 744 |
> |
break; |
| 745 |
> |
} |
| 746 |
|
} |
| 747 |
|
} |
| 748 |
|
if (!skip_folder && !exists("../GameDataFolder/IGMD/" + dir_itr->path().filename() + "/ignore.txt")) { |
| 757 |
|
copy_file(bsl_itr->path(), "../GameDataFolder/IGMD/" + dir_itr->path().filename() + "/" + bsl_itr->path().filename()); |
| 758 |
|
} |
| 759 |
|
} |
| 760 |
< |
BSLfolders.push_back( dir_itr->path().filename() ); //add back check for addon |
| 761 |
< |
BSLlog << "Pushing " << dir_itr->path().filename() << "\n" ; |
| 760 |
> |
if( !pkg.hasAddon ) { |
| 761 |
> |
BSLfolders.push_back( dir_itr->path().filename() ); //add back check for addon |
| 762 |
> |
BSLlog << "Pushing " << dir_itr->path().filename() << "\n" ; |
| 763 |
> |
} |
| 764 |
|
} |
| 765 |
|
} |
| 766 |
|
} |
| 866 |
|
return UPDATE_LOG_READ_ERR; |
| 867 |
|
} |
| 868 |
|
|
| 869 |
< |
// Is there an update folder, and is it a monthly release or a patch? |
| 869 |
> |
// Is there an update in the updates/ folder, and is it a monthly release or a patch? |
| 870 |
|
bool firstParty = 0; |
| 871 |
+ |
// First create the folder if it's missing, so users are never left wondering where updates are supposed to be put |
| 872 |
+ |
if (!exists("../updates")) |
| 873 |
+ |
create_directory("../updates"); |
| 874 |
|
if (exists("../updates/Edition")) |
| 875 |
|
{ |
| 876 |
|
firstParty = 1; |
| 1006 |
|
fstream file; |
| 1007 |
|
file.open((install_iter->path().string() + "/Mod_Info.cfg").c_str()); |
| 1008 |
|
if (!file.fail()) |
| 1009 |
< |
ModPackage updatePackage = fileToModPackage(file, install_iter->path().filename()); |
| 1009 |
> |
updatePackage = fileToModPackage(file, install_iter->path().filename()); |
| 1010 |
|
else |
| 1011 |
|
{ |
| 1012 |
|
file.close(); |
| 1013 |
|
continue; |
| 1014 |
|
} |
| 1015 |
< |
if (exists("packages" + install_iter->path().filename() + "/Mod_Info.cfg")) |
| 1015 |
> |
if (exists("packages/" + install_iter->path().filename() + "/Mod_Info.cfg")) |
| 1016 |
|
{ |
| 1017 |
|
file.close(); |
| 1018 |
< |
file.open(("packages" + install_iter->path().filename() + "/Mod_Info.cfg").c_str()); |
| 1018 |
> |
file.clear(); |
| 1019 |
> |
file.open(("packages/" + install_iter->path().filename() + "/Mod_Info.cfg").c_str()); |
| 1020 |
|
if (!file.fail()) |
| 1021 |
< |
ModPackage installedPackage = fileToModPackage(file, install_iter->path().filename()); |
| 1021 |
> |
installedPackage = fileToModPackage(file, install_iter->path().filename()); |
| 1022 |
|
file.close(); |
| 1023 |
|
if (updatePackage.modStringVersion > installedPackage.modStringVersion) |
| 1024 |
|
{ |
| 1033 |
|
} |
| 1034 |
|
} |
| 1035 |
|
} |
| 1007 |
– |
else |
| 1008 |
– |
{ |
| 1009 |
– |
file.close(); |
| 1010 |
– |
continue; |
| 1011 |
– |
} |
| 1012 |
– |
file.close(); |
| 1013 |
– |
|
| 1014 |
– |
file.open( ("packages" + install_iter->path().filename() + "/Mod_Info.cfg").c_str()); |
| 1015 |
– |
if (!file.fail()) |
| 1016 |
– |
{ |
| 1017 |
– |
ModPackage installedPackage = fileToModPackage(file, install_iter->path().filename()); |
| 1018 |
– |
} |
| 1019 |
– |
else |
| 1020 |
– |
{ |
| 1021 |
– |
file.close(); |
| 1022 |
– |
return UPDATE_THIRD_PARTY; |
| 1023 |
– |
} |
| 1024 |
– |
file.close(); |
| 1025 |
– |
if(((string)INSTALLER_VERSION).compare(updatePackage.installerVersion) < 1 && updatePackage.modStringVersion > installedPackage.modStringVersion) { |
| 1026 |
– |
return UPDATE_THIRD_PARTY; |
| 1027 |
– |
} |
| 1036 |
|
} |
| 1037 |
|
} |
| 1038 |
|
catch (exception & ex) { |
| 1052 |
|
string strDaodanVersion = "Daodan_Version"; |
| 1053 |
|
string strOniSplitVersion = "OniSplit_Version"; |
| 1054 |
|
string strGUIWinVersion = "GUI_Win_Version"; |
| 1055 |
< |
string strGUIMacVersion = "GUI_Mac_Version"; |
| 1055 |
> |
string strGUIMacVersion = "GUI_Mac_Version"; |
| 1056 |
|
string strReglobalize = "Reglobalize"; |
| 1057 |
|
string strDeleteList = "Delete_List"; |
| 1058 |
|
string strArrow = "->"; |
| 1294 |
|
return true; // returning 'true' tells the Installer to quit itself ASAP so it can be replaced by the process that is now running |
| 1295 |
|
} |
| 1296 |
|
|
| 1289 |
– |
|
| 1290 |
– |
void CrawlPackages(string pathToUpdate, string strPathToPackages) { |
| 1291 |
– |
try{ |
| 1292 |
– |
directory_iterator end; |
| 1293 |
– |
for ( directory_iterator update_iter( pathToUpdate ); |
| 1294 |
– |
update_iter != end; |
| 1295 |
– |
++update_iter ) |
| 1296 |
– |
{ |
| 1297 |
– |
|
| 1298 |
– |
ModPackage installedPackage, updatePackage; |
| 1299 |
– |
string updateStr = update_iter->path().string() + "/Mod_Info.cfg"; |
| 1300 |
– |
if ( !boost::iequals(update_iter->path().filename(),"Edition") |
| 1301 |
– |
&& !boost::iequals(update_iter->path().filename(),"Edition-patch") |
| 1302 |
– |
&& is_directory( update_iter->path() ) |
| 1303 |
– |
&& exists( update_iter->path().string() + "/Mod_Info.cfg" ) ) |
| 1304 |
– |
{ |
| 1305 |
– |
bool update = 0; |
| 1306 |
– |
fstream file; |
| 1307 |
– |
file.open( (update_iter->path().string() + "/Mod_Info.cfg").c_str()); |
| 1308 |
– |
if (!file.fail()) |
| 1309 |
– |
{ |
| 1310 |
– |
updatePackage = fileToModPackage(file, update_iter->path().filename()); |
| 1311 |
– |
} |
| 1312 |
– |
else |
| 1313 |
– |
{ |
| 1314 |
– |
file.close(); |
| 1315 |
– |
continue; |
| 1316 |
– |
} |
| 1317 |
– |
file.close(); |
| 1318 |
– |
file.clear(); |
| 1319 |
– |
if(exists(strPathToPackages + "/" + update_iter->path().filename() + "/Mod_Info.cfg")) |
| 1320 |
– |
{ |
| 1321 |
– |
file.open((strPathToPackages + "/" + update_iter->path().filename() + "/Mod_Info.cfg").c_str()); |
| 1322 |
– |
if (!file.fail()) |
| 1323 |
– |
{ |
| 1324 |
– |
installedPackage = fileToModPackage(file, update_iter->path().filename()); |
| 1325 |
– |
file.close(); |
| 1326 |
– |
if(updatePackage.modStringVersion > installedPackage.modStringVersion) { |
| 1327 |
– |
update = 1; |
| 1328 |
– |
} |
| 1329 |
– |
} |
| 1330 |
– |
else |
| 1331 |
– |
{ |
| 1332 |
– |
file.close(); |
| 1333 |
– |
update = 1; |
| 1334 |
– |
} |
| 1335 |
– |
file.close(); |
| 1336 |
– |
} |
| 1337 |
– |
else update = 1; |
| 1338 |
– |
if(update) { |
| 1339 |
– |
if(exists((path)(strPathToPackages + "/" + updatePackage.modStringName))) |
| 1340 |
– |
remove_all((path)(strPathToPackages + "/" + updatePackage.modStringName)); |
| 1341 |
– |
rename((path)(pathToUpdate + "/" + updatePackage.modStringName), (path)(strPathToPackages + "/" + updatePackage.modStringName)); |
| 1342 |
– |
|
| 1343 |
– |
} |
| 1344 |
– |
} |
| 1345 |
– |
} |
| 1346 |
– |
} |
| 1347 |
– |
catch (exception & ex) { |
| 1348 |
– |
// ex.what(); |
| 1349 |
– |
setStatusArea("Warning, handled exception: " + (string)ex.what()); |
| 1350 |
– |
} |
| 1351 |
– |
} |
| 1352 |
– |
|
| 1353 |
– |
|
| 1354 |
– |
bool ProcessThirdPartyUpdates() { |
| 1355 |
– |
CrawlPackages( "../updates", "./packages"); |
| 1356 |
– |
return true; |
| 1357 |
– |
// globalPackages = getPackages(); |
| 1358 |
– |
// refreshMods(globalInstalledMods); |
| 1359 |
– |
} |
| 1360 |
– |
|
| 1361 |
– |
|
| 1297 |
|
bool ProcessAEUpdate(Install_info_cfg *currentAE, Install_info_cfg *updateAE, bool *installerJustUpdated) |
| 1298 |
|
{ |
| 1299 |
+ |
try { |
| 1300 |
|
fstream file; |
| 1301 |
|
string line; |
| 1302 |
|
vector<string> tokens, updateStarted; |
| 1316 |
|
string strOniApp = "Oni.exe"; |
| 1317 |
|
#else |
| 1318 |
|
string strOniApp = "Oni.app"; |
| 1383 |
– |
#endif |
| 1319 |
|
bool needNewTrashDir = false; |
| 1320 |
+ |
#endif |
| 1321 |
+ |
|
| 1322 |
|
bool readingVerAndDate = false; |
| 1323 |
|
|
| 1324 |
|
#ifdef WIN32 |
| 1325 |
< |
string strTrashDir = "Trash\\"; // string unused in Windows because files are simply deleted |
| 1325 |
> |
//string strTrashDir = "Trash\\"; // string unused in Windows because files are simply deleted |
| 1326 |
|
#else |
| 1327 |
|
FILE *fUserName = NULL; |
| 1328 |
|
char chrUserName[32]; |
| 1357 |
|
if (readingVerAndDate && tokens.capacity() >= 3) |
| 1358 |
|
tokenize(tokens[2], updateStarted, "-"); |
| 1359 |
|
} |
| 1360 |
+ |
#ifndef WIN32 |
| 1361 |
|
if (updateStarted.capacity() < 3) |
| 1362 |
|
needNewTrashDir = true; |
| 1363 |
|
else |
| 1367 |
|
if (!exists(strTrashDir)) |
| 1368 |
|
needNewTrashDir = true; |
| 1369 |
|
} |
| 1370 |
+ |
#endif |
| 1371 |
|
} |
| 1372 |
|
#ifndef WIN32 |
| 1373 |
|
if (!*installerJustUpdated || needNewTrashDir) // prepare a new directory for deleted files to go to |
| 1384 |
|
// Special code to replace our special files -- the Oni app, OniSplit, the Daodan DLL, and the GUI for OniSplit |
| 1385 |
|
if (exists(strPathToEUFN + strOniApp)) |
| 1386 |
|
{ |
| 1387 |
< |
if (exists(strOniApp)) |
| 1388 |
< |
rename((path)strOniApp, (path)(strTrashDir + strOniApp)); |
| 1389 |
< |
rename((path)(strPathToEUFN + strOniApp), (path)strOniApp); |
| 1387 |
> |
if (exists("../" + strOniApp)) |
| 1388 |
> |
#ifdef WIN32 |
| 1389 |
> |
remove((path)("../" + strOniApp)); |
| 1390 |
> |
#else |
| 1391 |
> |
rename((path)("../" + strOniApp), (path)(strTrashDir + strOniApp)); |
| 1392 |
> |
#endif |
| 1393 |
> |
rename((path)(strPathToEUFN + strOniApp), (path)("../" + strOniApp)); |
| 1394 |
|
} |
| 1395 |
|
if (updateAE->OniSplitVersion.compare(currentAE->OniSplitVersion) >= 1) |
| 1396 |
|
{ |
| 1397 |
|
if (exists(strPathToEUFNInstall + strOniSplit)) |
| 1398 |
|
{ |
| 1399 |
|
if (exists(strOniSplit)) |
| 1400 |
+ |
#ifdef WIN32 |
| 1401 |
+ |
remove((path)strOniSplit); |
| 1402 |
+ |
#else |
| 1403 |
|
rename((path)strOniSplit, (path)(strTrashDir + strOniSplit)); |
| 1404 |
+ |
#endif |
| 1405 |
|
rename((path)(strPathToEUFNInstall + strOniSplit), (path)strOniSplit); |
| 1406 |
|
} |
| 1407 |
|
} |
| 1411 |
|
if (exists(strPathToEUFN + strDaodan)) |
| 1412 |
|
{ |
| 1413 |
|
if (exists(("../" + strDaodan))) |
| 1414 |
< |
rename((path)("../" + strDaodan), (path)(strTrashDir + strDaodan)); |
| 1414 |
> |
remove((path)("../" + strDaodan)); |
| 1415 |
|
rename((path)(strPathToEUFN + strDaodan), (path)("../" + strDaodan)); |
| 1416 |
|
} |
| 1417 |
|
} |
| 1420 |
|
if (exists(strPathToEUFNInstall + strWinGUI)) |
| 1421 |
|
{ |
| 1422 |
|
if (exists((path)strWinGUI)) |
| 1423 |
< |
rename((path)strWinGUI, (path)(strTrashDir + strWinGUI)); |
| 1423 |
> |
remove((path)strWinGUI); |
| 1424 |
|
if (exists(strWinGUILang)) |
| 1425 |
< |
rename((path)strWinGUILang, (path)(strTrashDir + strWinGUILang)); |
| 1425 |
> |
remove((path)strWinGUILang); |
| 1426 |
|
rename((path)(strPathToEUFNInstall + strWinGUI), (path)strWinGUI); |
| 1427 |
|
rename((path)(strPathToEUFNInstall + strWinGUILang), (path)strWinGUILang); |
| 1428 |
|
} |
| 1455 |
|
while (curPos != string::npos && curPos < thePath.size()) |
| 1456 |
|
{ |
| 1457 |
|
aParentPath = aParentPath + thePath.substr(lastPos, curPos - lastPos); |
| 1458 |
+ |
#ifndef WIN32 |
| 1459 |
|
if (!exists(strTrashDir + aParentPath)) |
| 1460 |
|
create_directory(strTrashDir + aParentPath); |
| 1461 |
+ |
#endif |
| 1462 |
|
lastPos = curPos + 1; |
| 1463 |
|
curPos = thePath.find("/", lastPos); |
| 1464 |
|
aParentPath = aParentPath + "/"; |
| 1503 |
|
for (vector<string>::iterator iter = filesToMove.begin(); iter != filesToMove.end(); iter++) |
| 1504 |
|
{ |
| 1505 |
|
if (exists(strPathToPackages + strGlobalize + *iter)) |
| 1506 |
+ |
#ifdef WIN32 |
| 1507 |
+ |
remove((path)(strPathToPackages + strGlobalize + *iter)); |
| 1508 |
+ |
#else |
| 1509 |
|
rename((path)(strPathToPackages + strGlobalize + *iter), (path)(strTrashDir + *iter)); |
| 1510 |
+ |
#endif |
| 1511 |
|
rename((path)(strPathToEUFNPackages + strGlobalize + *iter), (path)(strPathToPackages + strGlobalize + *iter)); |
| 1512 |
|
} |
| 1513 |
|
|
| 1514 |
|
// Clean up after ourselves, trashing any packages or programs in the update package that are not newer than the current AE |
| 1515 |
+ |
#ifdef WIN32 |
| 1516 |
+ |
remove_all((path)strPathToEUFN); |
| 1517 |
+ |
#else |
| 1518 |
|
create_directory(strTrashDir + "Unneeded update files"); |
| 1519 |
|
rename((path)strPathToEUFN, (path)(strTrashDir + "Unneeded update files/" + strEUFN)); |
| 1520 |
< |
|
| 1520 |
> |
#endif |
| 1521 |
|
// Write to log that we are finished with update |
| 1522 |
|
ptime end_time(second_clock::local_time()); |
| 1523 |
|
string progressMsg2 = "Edition was updated to:\n" + |
| 1535 |
|
CheckForGlobalization(true); // the 'true' value forces re-globalization |
| 1536 |
|
|
| 1537 |
|
globalPackages = getPackages(); // refresh the list in memory |
| 1538 |
< |
// TODO: Refresh the packages list in the window |
| 1539 |
< |
|
| 1538 |
> |
wxCommandEvent e; |
| 1539 |
> |
TheWindow->OnRefreshButtonClick( e ); |
| 1540 |
|
return true; |
| 1541 |
+ |
} |
| 1542 |
+ |
catch (exception & ex) |
| 1543 |
+ |
{ |
| 1544 |
+ |
setStatusArea("Warning, handled exception: " + (string)ex.what()); |
| 1545 |
+ |
return false; |
| 1546 |
+ |
} |
| 1547 |
+ |
|
| 1548 |
|
} |
| 1549 |
|
|
| 1550 |
|
void ProcessPackageUpdates(string pathToUpdate, string strPathToPackages) |
| 1597 |
|
if (!file.fail()) |
| 1598 |
|
{ |
| 1599 |
|
installedPackage = fileToModPackage(file, updtFolder); |
| 1600 |
< |
file.close(); |
| 1601 |
< |
if (updatePackage.modStringVersion > installedPackage.modStringVersion) |
| 1602 |
< |
{ |
| 1603 |
< |
if (updatePackage.installerVersion <= INSTALLER_VERSION) |
| 1604 |
< |
{ |
| 1600 |
> |
} |
| 1601 |
> |
file.close(); |
| 1602 |
> |
} |
| 1603 |
> |
file.close(); |
| 1604 |
> |
if (updatePackage.modStringVersion > installedPackage.modStringVersion) |
| 1605 |
> |
{ |
| 1606 |
> |
if (updatePackage.installerVersion <= INSTALLER_VERSION) |
| 1607 |
> |
{ |
| 1608 |
> |
if(exists(strPathToPackages + "/" + updatePackage.modStringName)) { |
| 1609 |
|
#ifdef WIN32 |
| 1610 |
< |
remove_all((path)(strPathToPackages + "/" + installedPackage.modStringName)); |
| 1610 |
> |
remove_all((path)(strPathToPackages + "/" + updatePackage.modStringName)); |
| 1611 |
|
#else |
| 1612 |
< |
if (needNewTrashDir) |
| 1613 |
< |
{ |
| 1614 |
< |
strTrashDir = strTrashDir + "Old_packages_" + boost::lexical_cast<string>(tmStartTime.tm_hour) + "-" + |
| 1615 |
< |
boost::lexical_cast<string>(tmStartTime.tm_min) + "-" + boost::lexical_cast<string>(tmStartTime.tm_sec) + "/"; |
| 1616 |
< |
create_directory(strTrashDir); |
| 1617 |
< |
needNewTrashDir = false; |
| 1651 |
< |
} |
| 1652 |
< |
rename((path)(strPathToPackages + "/" + installedPackage.modStringName), (path)(strTrashDir + installedPackage.modStringName)); |
| 1653 |
< |
#endif |
| 1654 |
< |
rename((path)(pathToUpdate + "/" + updatePackage.modStringName), (path)(strPathToPackages + "/" + updatePackage.modStringName)); |
| 1612 |
> |
if (needNewTrashDir) |
| 1613 |
> |
{ |
| 1614 |
> |
strTrashDir = strTrashDir + "Old_packages_" + boost::lexical_cast<string>(tmStartTime.tm_hour) + "-" + |
| 1615 |
> |
boost::lexical_cast<string>(tmStartTime.tm_min) + "-" + boost::lexical_cast<string>(tmStartTime.tm_sec) + "/"; |
| 1616 |
> |
create_directory(strTrashDir); |
| 1617 |
> |
needNewTrashDir = false; |
| 1618 |
|
} |
| 1619 |
+ |
rename((path)(strPathToPackages + "/" + updatePackage.modStringName), (path)(strTrashDir + updatePackage.modStringName)); |
| 1620 |
+ |
#endif |
| 1621 |
|
} |
| 1622 |
+ |
rename((path)(pathToUpdate + "/" + updatePackage.modStringName), (path)(strPathToPackages + "/" + updatePackage.modStringName)); |
| 1623 |
|
} |
| 1658 |
– |
else |
| 1659 |
– |
file.close(); |
| 1624 |
|
} |
| 1661 |
– |
file.close(); |
| 1662 |
– |
file.clear(); |
| 1625 |
|
} |
| 1626 |
|
} |
| 1627 |
|
} |
| 1629 |
|
{ |
| 1630 |
|
setStatusArea("Warning, handled exception: " + (string)ex.what()); |
| 1631 |
|
} |
| 1632 |
+ |
wxCommandEvent e; |
| 1633 |
+ |
TheWindow->OnRefreshButtonClick( e ); |
| 1634 |
|
} |
| 1635 |
|
|
| 1636 |
|
/* MakePathLocalToGlobalize is a function used once by ProcessAEUpdate() that takes a file in an \ |