Changeset 543 for AE/Installer/trunk/source
- Timestamp:
- May 24, 2010, 9:13:59 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/Installer/trunk/source/installer.cpp
r542 r543 1275 1275 bool ProcessAEUpdate(Install_info_cfg *currentAE, Install_info_cfg *updateAE, bool *installerJustUpdated) 1276 1276 { 1277 try { 1277 1278 fstream file; 1278 1279 string line; … … 1294 1295 #else 1295 1296 string strOniApp = "Oni.app"; 1296 #endif1297 1297 bool needNewTrashDir = false; 1298 #endif 1299 1298 1300 bool readingVerAndDate = false; 1299 1301 1300 1302 #ifdef WIN32 1301 string strTrashDir = "Trash\\"; // string unused in Windows because files are simply deleted1303 //string strTrashDir = "Trash\\"; // string unused in Windows because files are simply deleted 1302 1304 #else 1303 1305 FILE *fUserName = NULL; … … 1334 1336 tokenize(tokens[2], updateStarted, "-"); 1335 1337 } 1338 #ifndef WIN32 1336 1339 if (updateStarted.capacity() < 3) 1337 1340 needNewTrashDir = true; … … 1343 1346 needNewTrashDir = true; 1344 1347 } 1348 #endif 1345 1349 } 1346 1350 #ifndef WIN32 … … 1360 1364 { 1361 1365 if (exists(strOniApp)) 1366 #ifdef WIN32 1367 remove((path)strOniApp); 1368 #else 1362 1369 rename((path)strOniApp, (path)(strTrashDir + strOniApp)); 1370 #endif 1363 1371 rename((path)(strPathToEUFN + strOniApp), (path)strOniApp); 1364 1372 } … … 1368 1376 { 1369 1377 if (exists(strOniSplit)) 1378 #ifdef WIN32 1379 remove((path)strOniSplit); 1380 #else 1370 1381 rename((path)strOniSplit, (path)(strTrashDir + strOniSplit)); 1382 #endif 1371 1383 rename((path)(strPathToEUFNInstall + strOniSplit), (path)strOniSplit); 1372 1384 } … … 1378 1390 { 1379 1391 if (exists(("../" + strDaodan))) 1380 re name((path)("../" + strDaodan), (path)(strTrashDir+ strDaodan));1392 remove((path)("../" + strDaodan)); 1381 1393 rename((path)(strPathToEUFN + strDaodan), (path)("../" + strDaodan)); 1382 1394 } … … 1387 1399 { 1388 1400 if (exists((path)strWinGUI)) 1389 re name((path)strWinGUI, (path)(strTrashDir + strWinGUI));1401 remove((path)strWinGUI); 1390 1402 if (exists(strWinGUILang)) 1391 re name((path)strWinGUILang, (path)(strTrashDir + strWinGUILang));1403 remove((path)strWinGUILang); 1392 1404 rename((path)(strPathToEUFNInstall + strWinGUI), (path)strWinGUI); 1393 1405 rename((path)(strPathToEUFNInstall + strWinGUILang), (path)strWinGUILang); … … 1422 1434 { 1423 1435 aParentPath = aParentPath + thePath.substr(lastPos, curPos - lastPos); 1436 #ifndef WIN32 1424 1437 if (!exists(strTrashDir + aParentPath)) 1425 1438 create_directory(strTrashDir + aParentPath); 1439 #endif 1426 1440 lastPos = curPos + 1; 1427 1441 curPos = thePath.find("/", lastPos); … … 1468 1482 { 1469 1483 if (exists(strPathToPackages + strGlobalize + *iter)) 1484 #ifdef WIN32 1485 remove((path)(strPathToPackages + strGlobalize + *iter)); 1486 #else 1470 1487 rename((path)(strPathToPackages + strGlobalize + *iter), (path)(strTrashDir + *iter)); 1488 #endif 1471 1489 rename((path)(strPathToEUFNPackages + strGlobalize + *iter), (path)(strPathToPackages + strGlobalize + *iter)); 1472 1490 } 1473 1491 1474 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 1475 1496 create_directory(strTrashDir + "Unneeded update files"); 1476 1497 rename((path)strPathToEUFN, (path)(strTrashDir + "Unneeded update files/" + strEUFN)); 1477 1498 #endif 1478 1499 // Write to log that we are finished with update 1479 1500 ptime end_time(second_clock::local_time()); … … 1496 1517 TheWindow->OnRefreshButtonClick( e ); 1497 1518 return true; 1519 } 1520 catch (exception & ex) 1521 { 1522 setStatusArea("Warning, handled exception: " + (string)ex.what()); 1523 return false; 1524 } 1525 1498 1526 } 1499 1527
Note:
See TracChangeset
for help on using the changeset viewer.