ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/AE/Installer/trunk/source/installer.cpp
(Generate patch)

Comparing AE/Installer/trunk/source/installer.cpp (file contents):
Revision 495 by gumby, Sun Jan 24 23:58:16 2010 UTC vs.
Revision 496 by gumby, Mon Feb 22 00:00:55 2010 UTC

# Line 1142 | Line 1142 | bool ProcessInstallerUpdate(Install_info
1142          string popenCommand = "../updates/" + strEUFN + "/install/";
1143   #ifdef WIN32
1144          // TODO: Fill in Windows equivalent of code below :-3
1145 +        popenCommand = "replace_installer.bat";
1146   #else
1147          // We can't just use '~' to mean "the home directory" because we need to check the path in C...
1148          // ...so we actually get the current user's shortname and manually construct the path to home
# Line 1163 | Line 1164 | bool ProcessInstallerUpdate(Install_info
1164   #endif
1165          file.close();
1166          file.clear();
1167 + #ifdef WIN32
1168 +        system(popenCommand.c_str());
1169 + #else
1170          popen(popenCommand.c_str(), "r");
1171 <        
1171 > #endif
1172          return true; // returning 'true' tells the Installer to quit itself ASAP so it can be replaced by the process that is now running
1173   }
1174  
# Line 1195 | Line 1199 | bool ProcessAEUpdate(Install_info_cfg *c
1199          
1200          // TODO: Fill in Windows equivalent of code below
1201   #ifdef WIN32
1202 <        string strTrashDir = "%RECYCLE%";
1202 >        string strTrashDir = "Trash\\";
1203   #else
1204          FILE *fUserName = NULL;
1205          char chrUserName[32];
# Line 1240 | Line 1244 | bool ProcessAEUpdate(Install_info_cfg *c
1244                                  needNewTrashDir = true;
1245                  }
1246          }
1247 <        
1247 > #ifndef WIN32
1248          if (!*installerJustUpdated || needNewTrashDir) // prepare a new directory for deleted files to go to
1249          {
1250                  tm tmStartTime = to_tm(startTime);
# Line 1248 | Line 1252 | bool ProcessAEUpdate(Install_info_cfg *c
1252                                            boost::lexical_cast<string>(tmStartTime.tm_min) + "-" + boost::lexical_cast<string>(tmStartTime.tm_sec) + "/";
1253                  create_directory(strTrashDir);
1254          }
1255 + #endif
1256          file.close();
1257          file.clear();
1258  
# Line 1323 | Line 1328 | bool ProcessAEUpdate(Install_info_cfg *c
1328                                  curPos = thePath.find("/", lastPos);
1329                                  aParentPath = aParentPath + "/";
1330                          }
1331 + #ifndef WIN32
1332                          rename((path)("../" + thePath), (path)(strTrashDir + thePath));
1333 + #else
1334 +                        remove((path)("../" + thePath));
1335 + #endif
1336                  }
1337          }
1338          
# Line 1346 | Line 1355 | bool ProcessAEUpdate(Install_info_cfg *c
1355                                  matchFound = true;
1356                                  if (iter1->modStringVersion > iter2->modStringVersion)
1357                                  {
1358 + #ifndef WIN32
1359                                          rename((path)(strPathToPackages + iter2->modStringName), (path)(strTrashDir + iter2->modStringName));
1360 + #else
1361 +                                        remove((path)(strPathToPackages + iter2->modStringName));
1362 + #endif
1363                                          rename((path)(strPathToEUFNPackages + iter1->modStringName), (path)(strPathToPackages + iter1->modStringName));
1364                                  }
1365                          }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)