Changeset 553 for AE/Installer/trunk/source
- Timestamp:
- May 29, 2010, 4:09:04 AM (14 years ago)
- Location:
- AE/Installer/trunk/source
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/Installer/trunk/source/globals.h
r506 r553 41 41 42 42 //#pragma mark DEFINES 43 #define INSTALLER_VERSION "1.1" // only place we need to change this43 #define INSTALLER_VERSION "1.1" // only place in source we need to change this 44 44 #define UPDATE_LOG_READ_ERR -1 45 45 #define UPDATE_INST_REPL_ERR -2 -
AE/Installer/trunk/source/installer.cpp
r552 r553 311 311 run Oni before :-p */ 312 312 string fullAEpath = escapePath(system_complete(".").parent_path().parent_path().string()); // get full path for Edition/ (Oni wants folder that *contains* the GDF) 313 //bad Iritscen, bad! fixed buffers can cause crashes.314 /*char prefsCommand[300] = "[ -f ~/Library/Preferences/com.godgames.oni.plist ] && defaults write com.godgames.oni RetailInstallationPath -string '";315 strcat(prefsCommand, fullAEpath.c_str());316 strcat(prefsCommand, "'"); // path string is enclosed in single quotes to avoid the need to escape UNIX-unfriendly characters317 */318 313 string prefsCommand = "[ -f ~/Library/Preferences/com.godgames.oni.plist ] && defaults write com.godgames.oni RetailInstallationPath -string '" 319 314 + fullAEpath + "'"; … … 990 985 } 991 986 992 if (updateAE->AEVersion.compare(currentAE->AEVersion) >= 1) // is the release update newer than what's installed? 993 { 994 if (!strEUFN.compare("Edition-patch")) // if update is a patch... 995 { 996 if (currentAE->AEVersion.compare(updateAE->AEVersion.substr(0, updateAE->AEVersion.length() - 1))) // ...is it for a different month? 997 return UPDATE_MNTH_REQD_ERR; 998 } 987 if (updateAE->AEVersion.compare(currentAE->AEVersion) > 0) // is the release update newer than what's installed? 988 { 999 989 string strNewInstallerPath = "../updates/" + strEUFN + "/install/" + strInstallerName; 1000 990 string installerVersion = INSTALLER_VERSION; … … 1009 999 return UPDATE_SIMP_AVAIL; 1010 1000 } 1001 else 1002 return UPDATE_MNTH_REQD_ERR; 1011 1003 } 1012 1004 try … … 1495 1487 ProcessPackageUpdates(strPathToEUFNPackages, strPathToPackages); 1496 1488 1497 // Next, we get a list of which files and folders in the update's Globalize folder to move over; all files not starting with '.' will be moved...1498 // ... and folders which do not exist in the current AE will be created there1499 vector<string> foldersToMake, filesToMove;1500 stringthePath;1489 // Next, move over files in the update's Globalize folder; subfolders which do not exist in the current AE will be created by Boost's... 1490 // ...create_directories() function 1491 string strPath; 1492 path thePath; 1501 1493 for (recursive_directory_iterator dir_itr(strPathToEUFNPackages + strGlobalize), end_itr; dir_itr != end_itr; ++dir_itr) 1502 1494 { 1503 thePath = dir_itr->path().string(); 1504 MakePathLocalToGlobalize(&thePath); 1495 strPath = dir_itr->path().string(); 1496 MakePathLocalToGlobalize(&strPath); 1497 thePath = (path)strPath; 1505 1498 if (is_regular_file(dir_itr->status())) 1506 1499 { 1507 if (dir_itr->filename().at(0) != '.') // skip over dot-files, which are invisible in Unix 1508 filesToMove.push_back(thePath); 1509 } 1510 else if (is_directory(dir_itr->status())) 1511 { 1512 if (!exists(strPathToPackages + strGlobalize + thePath)) 1513 foldersToMake.push_back(thePath); 1514 } 1515 } 1516 // Sort the foldersToMake strings by length, which is a fast solution to the problem of "How do we make sure we create folder 'parent/'... 1517 // ...before folder 'parent/child/'"? 1518 sort(foldersToMake.begin(), foldersToMake.end(), SortBySize); // SortBySize is a custom comparison function found later in this source file 1519 // First make the folders that don't exist in the current AE, so all the files have a place to go 1520 for (vector<string>::iterator iter = foldersToMake.begin(); iter != foldersToMake.end(); iter++) 1521 { 1522 create_directory(strPathToPackages + strGlobalize + *iter); 1523 } 1524 for (vector<string>::iterator iter = filesToMove.begin(); iter != filesToMove.end(); iter++) 1525 { 1526 if (exists(strPathToPackages + strGlobalize + *iter)) 1500 if (thePath.filename().at(0) != '.') // skip over dot-files, which are invisible in Unix 1501 { 1502 if (exists(strPathToPackages + strGlobalize + strPath)) 1503 { 1527 1504 #ifdef WIN32 1528 remove((path)(strPathToPackages + strGlobalize + *iter));1505 remove((path)(strPathToPackages + strGlobalize + strPath)); 1529 1506 #else 1530 rename((path)(strPathToPackages + strGlobalize + *iter), (path)(strTrashDir + *iter)); 1531 #endif 1532 rename((path)(strPathToEUFNPackages + strGlobalize + *iter), (path)(strPathToPackages + strGlobalize + *iter)); 1507 create_directories((path)(strTrashDir + thePath.parent_path().string())); 1508 rename((path)(strPathToPackages + strGlobalize + strPath), (path)(strTrashDir + strPath)); 1509 #endif 1510 rename((path)(strPathToEUFNPackages + strGlobalize + strPath), (path)(strPathToPackages + strGlobalize + strPath)); 1511 } 1512 else 1513 { 1514 int slashLoc = 0; 1515 slashLoc = strPath.find("/", 0); 1516 if (slashLoc != string::npos) // then path contains slashes, so we need to make sure its parents' paths exist before moving it 1517 create_directories((path)(strPathToPackages + strGlobalize + thePath.parent_path().string())); 1518 rename((path)(strPathToEUFNPackages + strGlobalize + strPath), (path)(strPathToPackages + strGlobalize + strPath)); 1519 } 1520 } 1521 } 1533 1522 } 1534 1523 … … 1566 1555 return false; 1567 1556 } 1568 1569 1557 } 1570 1558 … … 1751 1739 } 1752 1740 else if(from_ph.filename() != ".svn") 1753 { 1754 path destination; 1755 if(!exists(to_ph)) 1756 { 1757 destination=to_ph; 1758 } 1759 else 1760 { 1761 destination=to_ph/from_ph.filename(); 1762 } 1741 { 1742 path destination; 1743 if(!exists(to_ph)) 1744 { 1745 destination=to_ph; 1746 } 1747 else 1748 { 1749 destination=to_ph/from_ph.filename(); 1750 } 1763 1751 1764 for(directory_iterator i(from_ph); i!=directory_iterator(); ++i) 1752 for(directory_iterator i(from_ph); i!=directory_iterator(); ++i) 1765 1753 { 1766 1754 //the idiot who coded this in the first place (not me) 1767 1755 //forgot to make a new directory. Exception city. x_x 1768 create_directory(destination); 1769 copy(*i, destination/i->filename());1756 create_directory(destination); 1757 copy(*i, destination/i->filename()); 1770 1758 } 1771 1759 }
Note:
See TracChangeset
for help on using the changeset viewer.