| 1274 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1275 |  | bool ProcessAEUpdate(Install_info_cfg *currentAE, Install_info_cfg *updateAE, bool *installerJustUpdated) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1276 |  | { | 
 
 
 
 
 
 
 
 | 1277 | + | try { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1278 |  | fstream file; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1279 |  | string line; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1280 |  | vector<string> tokens, updateStarted; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1294 |  | string strOniApp = "Oni.exe"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1295 |  | #else | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1296 |  | string strOniApp = "Oni.app"; | 
 
 
 
 
 
 
 
 
 | 1296 | – | #endif | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1297 |  | bool needNewTrashDir = false; | 
 
 
 
 
 
 
 
 | 1298 | + | #endif | 
 
 
 
 
 
 
 
 | 1299 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1300 |  | bool readingVerAndDate = false; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1301 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1302 |  | #ifdef WIN32 | 
 
 
 
 
 
 
 
 
 
 
 | 1303 | < | string strTrashDir = "Trash\\"; // string unused in Windows because files are simply deleted | 
 
 
 
 
 
 
 
 
 | 1303 | > | //string strTrashDir = "Trash\\"; // string unused in Windows because files are simply deleted | 
 
 
 
 
 
 
 
 
 
 
 | 1304 |  | #else | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1305 |  | FILE *fUserName = NULL; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1306 |  | char chrUserName[32]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1335 |  | if (readingVerAndDate && tokens.capacity() >= 3) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1336 |  | tokenize(tokens[2], updateStarted, "-"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1337 |  | } | 
 
 
 
 
 
 
 
 | 1338 | + | #ifndef WIN32 | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1339 |  | if (updateStarted.capacity() < 3) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1340 |  | needNewTrashDir = true; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1341 |  | else | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1345 |  | if (!exists(strTrashDir)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1346 |  | needNewTrashDir = true; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1347 |  | } | 
 
 
 
 
 
 
 
 | 1348 | + | #endif | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1349 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1350 |  | #ifndef WIN32 | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1351 |  | if (!*installerJustUpdated || needNewTrashDir) // prepare a new directory for deleted files to go to | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1363 |  | if (exists(strPathToEUFN + strOniApp)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1364 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1365 |  | if (exists(strOniApp)) | 
 
 
 
 
 
 
 
 | 1366 | + | #ifdef WIN32 | 
 
 
 
 
 
 
 
 | 1367 | + | remove((path)strOniApp); | 
 
 
 
 
 
 
 
 | 1368 | + | #else | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1369 |  | rename((path)strOniApp, (path)(strTrashDir + strOniApp)); | 
 
 
 
 
 
 
 
 | 1370 | + | #endif | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1371 |  | rename((path)(strPathToEUFN + strOniApp), (path)strOniApp); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1372 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1373 |  | if (updateAE->OniSplitVersion.compare(currentAE->OniSplitVersion) >= 1) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1375 |  | if (exists(strPathToEUFNInstall + strOniSplit)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1376 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1377 |  | if (exists(strOniSplit)) | 
 
 
 
 
 
 
 
 | 1378 | + | #ifdef WIN32 | 
 
 
 
 
 
 
 
 | 1379 | + | remove((path)strOniSplit); | 
 
 
 
 
 
 
 
 | 1380 | + | #else | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1381 |  | rename((path)strOniSplit, (path)(strTrashDir + strOniSplit)); | 
 
 
 
 
 
 
 
 | 1382 | + | #endif | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1383 |  | rename((path)(strPathToEUFNInstall + strOniSplit), (path)strOniSplit); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1384 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1385 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1389 |  | if (exists(strPathToEUFN + strDaodan)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1390 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1391 |  | if (exists(("../" + strDaodan))) | 
 
 
 
 
 
 
 
 
 
 
 | 1392 | < | rename((path)("../" + strDaodan), (path)(strTrashDir + strDaodan)); | 
 
 
 
 
 
 
 
 
 | 1392 | > | remove((path)("../" + strDaodan)); | 
 
 
 
 
 
 
 
 
 
 
 | 1393 |  | rename((path)(strPathToEUFN + strDaodan), (path)("../" + strDaodan)); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1394 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1395 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1398 |  | if (exists(strPathToEUFNInstall + strWinGUI)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1399 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1400 |  | if (exists((path)strWinGUI)) | 
 
 
 
 
 
 
 
 
 
 
 | 1401 | < | rename((path)strWinGUI, (path)(strTrashDir + strWinGUI)); | 
 
 
 
 
 
 
 
 
 | 1401 | > | remove((path)strWinGUI); | 
 
 
 
 
 
 
 
 
 
 
 | 1402 |  | if (exists(strWinGUILang)) | 
 
 
 
 
 
 
 
 
 
 
 | 1403 | < | rename((path)strWinGUILang, (path)(strTrashDir + strWinGUILang)); | 
 
 
 
 
 
 
 
 
 | 1403 | > | remove((path)strWinGUILang); | 
 
 
 
 
 
 
 
 
 
 
 | 1404 |  | rename((path)(strPathToEUFNInstall + strWinGUI), (path)strWinGUI); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1405 |  | rename((path)(strPathToEUFNInstall + strWinGUILang), (path)strWinGUILang); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1406 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1433 |  | while (curPos != string::npos && curPos < thePath.size()) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1434 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1435 |  | aParentPath = aParentPath + thePath.substr(lastPos, curPos - lastPos); | 
 
 
 
 
 
 
 
 | 1436 | + | #ifndef WIN32 | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1437 |  | if (!exists(strTrashDir + aParentPath)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1438 |  | create_directory(strTrashDir + aParentPath); | 
 
 
 
 
 
 
 
 | 1439 | + | #endif | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1440 |  | lastPos = curPos + 1; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1441 |  | curPos = thePath.find("/", lastPos); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1442 |  | aParentPath = aParentPath + "/"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1481 |  | for (vector<string>::iterator iter = filesToMove.begin(); iter != filesToMove.end(); iter++) | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1482 |  | { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1483 |  | if (exists(strPathToPackages + strGlobalize + *iter)) | 
 
 
 
 
 
 
 
 | 1484 | + | #ifdef WIN32 | 
 
 
 
 
 
 
 
 | 1485 | + | remove((path)(strPathToPackages + strGlobalize + *iter)); | 
 
 
 
 
 
 
 
 | 1486 | + | #else | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1487 |  | rename((path)(strPathToPackages + strGlobalize + *iter), (path)(strTrashDir + *iter)); | 
 
 
 
 
 
 
 
 | 1488 | + | #endif | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1489 |  | rename((path)(strPathToEUFNPackages + strGlobalize + *iter), (path)(strPathToPackages + strGlobalize + *iter)); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1490 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1491 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1492 |  | // Clean up after ourselves, trashing any packages or programs in the update package that are not newer than the current AE | 
 
 
 
 
 
 
 
 | 1493 | + | #ifdef WIN32 | 
 
 
 
 
 
 
 
 | 1494 | + | remove((path)strPathToEUFN); | 
 
 
 
 
 
 
 
 | 1495 | + | #else | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1496 |  | create_directory(strTrashDir + "Unneeded update files"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1497 |  | rename((path)strPathToEUFN, (path)(strTrashDir + "Unneeded update files/" + strEUFN)); | 
 
 
 
 
 
 
 
 
 
 
 | 1498 | < |  | 
 
 
 
 
 
 
 
 
 | 1498 | > | #endif | 
 
 
 
 
 
 
 
 
 
 
 | 1499 |  | // Write to log that we are finished with update | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1500 |  | ptime end_time(second_clock::local_time()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1501 |  | string progressMsg2 = "Edition was updated to:\n" + | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1516 |  | wxCommandEvent e; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1517 |  | TheWindow->OnRefreshButtonClick( e ); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1518 |  | return true; | 
 
 
 
 
 
 
 
 | 1519 | + | } | 
 
 
 
 
 
 
 
 | 1520 | + | catch (exception & ex) | 
 
 
 
 
 
 
 
 | 1521 | + | { | 
 
 
 
 
 
 
 
 | 1522 | + | setStatusArea("Warning, handled exception: " + (string)ex.what()); | 
 
 
 
 
 
 
 
 | 1523 | + | return false; | 
 
 
 
 
 
 
 
 | 1524 | + | } | 
 
 
 
 
 
 
 
 | 1525 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1526 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1527 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1528 |  | void ProcessPackageUpdates(string pathToUpdate, string strPathToPackages) |