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 508 by gumby, Sat Apr 24 17:52:34 2010 UTC vs.
Revision 509 by gumby, Sat Apr 24 19:19:14 2010 UTC

# Line 975 | Line 975 | int GetUpdateStatus(Install_info_cfg *cu
975                                  ModPackage installedPackage, updatePackage;
976                                  if (is_directory(install_iter->path()) && exists(install_iter->path().string() + "/Mod_Info.cfg"))
977                                  {
978 +                                        string blah =install_iter->path().string() + "/Mod_Info.cfg";
979 +                                        string blah2 = "packages/" + install_iter->path().filename() + "/Mod_Info.cfg";
980                                          fstream file;
981                                          file.open((install_iter->path().string() + "/Mod_Info.cfg").c_str());
982                                          if (!file.fail())
983 <                                                ModPackage updatePackage = fileToModPackage(file, install_iter->path().filename());
983 >                                                updatePackage = fileToModPackage(file, install_iter->path().filename());
984                                          else
985                                          {
986                                                  file.close();
987                                                  continue;
988                                          }
989 <                                        if (exists("packages" + install_iter->path().filename() + "/Mod_Info.cfg"))
989 >                                        if (exists("packages/" + install_iter->path().filename() + "/Mod_Info.cfg"))
990                                          {
991                                                  file.close();
992 <                                                file.open(("packages" + install_iter->path().filename() + "/Mod_Info.cfg").c_str());
992 >                                                file.clear();
993 >                                                file.open(("packages/" + install_iter->path().filename() + "/Mod_Info.cfg").c_str());
994                                                  if (!file.fail())
995 <                                                        ModPackage installedPackage = fileToModPackage(file, install_iter->path().filename());
995 >                                                        installedPackage = fileToModPackage(file, install_iter->path().filename());
996                                                  file.close();
997                                                  if (updatePackage.modStringVersion > installedPackage.modStringVersion)
998                                                  {
# Line 1489 | Line 1492 | bool ProcessAEUpdate(Install_info_cfg *c
1492  
1493          return true;
1494   }
1495 <
1495 > extern MainWindow* TheWindow;
1496   void ProcessPackageUpdates(string pathToUpdate, string strPathToPackages)
1497   {
1498          ptime startTime(second_clock::local_time());
# Line 1540 | Line 1543 | void ProcessPackageUpdates(string pathTo
1543                                          if (!file.fail())
1544                                          {
1545                                                  installedPackage = fileToModPackage(file, updtFolder);
1546 <                                                file.close();
1547 <                                                if (updatePackage.modStringVersion > installedPackage.modStringVersion)
1548 <                                                {
1549 <                                                        if (updatePackage.installerVersion <= INSTALLER_VERSION)
1550 <                                                        {
1546 >                                        }
1547 >                                        file.close();
1548 >                                }
1549 >                                file.close();
1550 >                                if (updatePackage.modStringVersion > installedPackage.modStringVersion)
1551 >                                {
1552 >                                        if (updatePackage.installerVersion <= INSTALLER_VERSION)
1553 >                                        {
1554 >                                                if(exists(strPathToPackages +  "/" + updatePackage.modStringName)) {
1555   #ifdef WIN32
1556 <                                                                remove_all((path)(strPathToPackages +  "/" + installedPackage.modStringName));
1556 >                                                        remove_all((path)(strPathToPackages +  "/" + updatePackage.modStringName));
1557   #else
1558 <                                                                if (needNewTrashDir)
1559 <                                                                {
1560 <                                                                        strTrashDir = strTrashDir + "Old_packages_" + boost::lexical_cast<string>(tmStartTime.tm_hour) + "-" +
1561 <                                                                                                  boost::lexical_cast<string>(tmStartTime.tm_min) + "-" + boost::lexical_cast<string>(tmStartTime.tm_sec) + "/";
1562 <                                                                        create_directory(strTrashDir);
1563 <                                                                        needNewTrashDir = false;
1557 <                                                                }
1558 <                                                                rename((path)(strPathToPackages +  "/" + installedPackage.modStringName), (path)(strTrashDir + installedPackage.modStringName));
1559 < #endif
1560 <                                                                rename((path)(pathToUpdate + "/" + updatePackage.modStringName), (path)(strPathToPackages + "/" + updatePackage.modStringName));
1558 >                                                        if (needNewTrashDir)
1559 >                                                        {
1560 >                                                                strTrashDir = strTrashDir + "Old_packages_" + boost::lexical_cast<string>(tmStartTime.tm_hour) + "-" +
1561 >                                                                        boost::lexical_cast<string>(tmStartTime.tm_min) + "-" + boost::lexical_cast<string>(tmStartTime.tm_sec) + "/";
1562 >                                                                create_directory(strTrashDir);
1563 >                                                                needNewTrashDir = false;
1564                                                          }
1565 +                                                        rename((path)(strPathToPackages +  "/" + updatePackage.modStringName), (path)(strTrashDir + updatePackage.modStringName));
1566 + #endif
1567                                                  }
1568 +                                                rename((path)(pathToUpdate + "/" + updatePackage.modStringName), (path)(strPathToPackages + "/" + updatePackage.modStringName));
1569                                          }
1564                                        else
1565                                                file.close();
1570                                  }
1567                                file.close();
1568                                file.clear();
1571                          }
1572                  }
1573          }
# Line 1573 | Line 1575 | void ProcessPackageUpdates(string pathTo
1575          {
1576                  setStatusArea("Warning, handled exception: " + (string)ex.what());
1577          }
1578 +        wxCommandEvent e;
1579 +        TheWindow->OnRefreshButtonClick( e );
1580   }
1581  
1582   /* MakePathLocalToGlobalize is a function used once by ProcessAEUpdate() that takes a file in an        \

Diff Legend

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