--- AE/Installer/trunk/source/installer.cpp 2010/01/24 23:58:16 489 +++ AE/Installer/trunk/source/installer.cpp 2010/02/22 00:00:55 496 @@ -1142,6 +1142,7 @@ bool ProcessInstallerUpdate(Install_info string popenCommand = "../updates/" + strEUFN + "/install/"; #ifdef WIN32 // TODO: Fill in Windows equivalent of code below :-3 + popenCommand = "replace_installer.bat"; #else // We can't just use '~' to mean "the home directory" because we need to check the path in C... // ...so we actually get the current user's shortname and manually construct the path to home @@ -1163,8 +1164,11 @@ bool ProcessInstallerUpdate(Install_info #endif file.close(); file.clear(); +#ifdef WIN32 + system(popenCommand.c_str()); +#else popen(popenCommand.c_str(), "r"); - +#endif return true; // returning 'true' tells the Installer to quit itself ASAP so it can be replaced by the process that is now running } @@ -1195,7 +1199,7 @@ bool ProcessAEUpdate(Install_info_cfg *c // TODO: Fill in Windows equivalent of code below #ifdef WIN32 - string strTrashDir = "%RECYCLE%"; + string strTrashDir = "Trash\\"; #else FILE *fUserName = NULL; char chrUserName[32]; @@ -1240,7 +1244,7 @@ bool ProcessAEUpdate(Install_info_cfg *c needNewTrashDir = true; } } - +#ifndef WIN32 if (!*installerJustUpdated || needNewTrashDir) // prepare a new directory for deleted files to go to { tm tmStartTime = to_tm(startTime); @@ -1248,6 +1252,7 @@ bool ProcessAEUpdate(Install_info_cfg *c boost::lexical_cast(tmStartTime.tm_min) + "-" + boost::lexical_cast(tmStartTime.tm_sec) + "/"; create_directory(strTrashDir); } +#endif file.close(); file.clear(); @@ -1323,7 +1328,11 @@ bool ProcessAEUpdate(Install_info_cfg *c curPos = thePath.find("/", lastPos); aParentPath = aParentPath + "/"; } +#ifndef WIN32 rename((path)("../" + thePath), (path)(strTrashDir + thePath)); +#else + remove((path)("../" + thePath)); +#endif } } @@ -1346,7 +1355,11 @@ bool ProcessAEUpdate(Install_info_cfg *c matchFound = true; if (iter1->modStringVersion > iter2->modStringVersion) { +#ifndef WIN32 rename((path)(strPathToPackages + iter2->modStringName), (path)(strTrashDir + iter2->modStringName)); +#else + remove((path)(strPathToPackages + iter2->modStringName)); +#endif rename((path)(strPathToEUFNPackages + iter1->modStringName), (path)(strPathToPackages + iter1->modStringName)); } }