| 17 | 
   | 
 #include "boost/date_time/gregorian/gregorian.hpp" | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 18 | 
   | 
 #include "boost/date_time/date_parsing.hpp" | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 19 | 
   | 
 #include "boost/date_time/posix_time/posix_time.hpp" | 
 
 
 
 
 
 
 
 
 | 20 | 
 + | 
 #include <boost/algorithm/string.hpp> | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 21 | 
   | 
 #include "installer.h" | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 22 | 
   | 
 #include "aeinstallerapp.h" | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 23 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 270 | 
   | 
                 setStatusArea("Step " + lexical_cast<std::string>(parts_done + 1) + "/" + lexical_cast<std::string>(total_steps) + ": moving level0_Characters" );       | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 271 | 
   | 
                 copy((path)"../GameDataFolder/level0_Characters", (path)("VanillaDats/level0_Final")); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 272 | 
   | 
                 GDFPaths.push_back( Characters ); | 
 
 
 
 
 
 
 
 
 | 273 | 
 + | 
                 //concactates level0.... | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 274 | 
   | 
                 for(int i = 0; i < GDFPaths.size(); i++)  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 275 | 
   | 
                 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 276 | 
   | 
                         directory_iterator end_iter; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 285 | 
   | 
                                 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 286 | 
   | 
                         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 287 | 
   | 
                 } | 
 
 
 
 
 
 
 
 
 | 288 | 
 + | 
                 //?: syntax is fun. | 
 
 
 
 
 
 
 
 
 | 289 | 
 + | 
                 //condition ? value_if_true : value_if_false  | 
 
 
 
 
 
 
 
 
 | 290 | 
 + | 
                 (is_empty(Characters)   ? remove( Characters )  : 1); | 
 
 
 
 
 
 
 
 
 | 291 | 
 + | 
                 (is_empty(Particles)    ? remove( Particles )   : 1); | 
 
 
 
 
 
 
 
 
 | 292 | 
 + | 
                 (is_empty(Textures)             ? remove( Textures )    : 1); | 
 
 
 
 
 
 
 
 
 | 293 | 
 + | 
                 (is_empty(Sounds)               ? remove( Sounds )              : 1); | 
 
 
 
 
 
 
 
 
 | 294 | 
 + | 
                 (is_empty(TRAC)                 ? remove( TRAC )                : 1); | 
 
 
 
 
 
 
 
 
 | 295 | 
 + | 
                 (is_empty(TRAM)                 ? remove( TRAM )                : 1); | 
 
 
 
 
 
 
 
 
 | 296 | 
 + | 
                 (is_empty(Animations)   ? remove( Animations )  : 1); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 297 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 298 | 
   | 
                 create_directory((path)"../GameDataFolder/IGMD"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 299 | 
   | 
                 copy((path)"packages/VanillaBSL/IGMD", (path)"../GameDataFolder"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 300 | 
   | 
                 setProgressBar( 1000 ); | 
 
 
 
 
 
 
 
 
 
 
 
 | 301 | 
 < | 
                  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 302 | 
 < | 
                 if(exists("../../persist.dat")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 303 | 
 < | 
                         if(!exists("../persist.dat"))  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 304 | 
 < | 
                          | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 294 | 
 < | 
                         //TODO: Concatenate level0 Dirs. | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 295 | 
 < | 
                          | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 296 | 
 < | 
                                 copy("../../persist.dat",".."); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 297 | 
 < | 
                 if(exists("../../key_config.txt")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 298 | 
 < | 
                         if(!exists("../key_config.txt")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 299 | 
 < | 
                                 copy("../../key_config.txt","..");  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 300 | 
 < | 
                  | 
 
 
 
 
 
 
 
 
 
 | 301 | 
 > | 
  | 
 
 
 
 
 
 | 302 | 
 > | 
                 if(exists("../../persist.dat") && !exists("../persist.dat")) copy("../../persist.dat",".."); | 
 
 
 
 
 
 | 303 | 
 > | 
                 if(exists("../../key_config.txt")&& !exists("../key_config.txt")) copy("../../key_config.txt","..");  | 
 
 
 
 
 
 | 304 | 
 > | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 305 | 
   | 
 #ifndef WIN32 | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 306 | 
   | 
                 /* On Mac only, set the current GDF to the AE GDF by writing to Oni's global preferences file (thankfully a standard OS X ".plist" XML file). | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 307 | 
   | 
                  Tests for presence of prefs with [ -f ] before doing anything so it doesn't create a partial prefs file -- just in case user has never | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 308 | 
   | 
                  run Oni before :-p */ | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 309 | 
   | 
                 string fullAEpath = escapePath(system_complete(".").parent_path().parent_path().string()); // get full path for Edition/ (Oni wants the folder that *contains* the GDF) | 
 
 
 
 
 
 
 
 
 
 
 
 | 310 | 
 < | 
                 char prefsCommand[300] = "[ -f ~/Library/Preferences/com.godgames.oni.plist ] && defaults write com.godgames.oni RetailInstallationPath -string '"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 310 | 
 > | 
                 //bad Iritscen, bad! fixed buffers can cause crashes. | 
 
 
 
 
 
 | 311 | 
 > | 
                 /*char prefsCommand[300] = "[ -f ~/Library/Preferences/com.godgames.oni.plist ] && defaults write com.godgames.oni RetailInstallationPath -string '"; | 
 
 
 
 
 
 
 
 
 
 
 
 | 312 | 
   | 
                 strcat(prefsCommand, fullAEpath.c_str()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 313 | 
   | 
                 strcat(prefsCommand, "'"); // path string is enclosed in single quotes to avoid the need to escape UNIX-unfriendly characters | 
 
 
 
 
 
 
 
 
 
 
 
 | 314 | 
 < | 
                 system(prefsCommand); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 314 | 
 > | 
                 */ | 
 
 
 
 
 
 | 315 | 
 > | 
                 string prefsCommand = "[ -f ~/Library/Preferences/com.godgames.oni.plist ] && defaults write com.godgames.oni RetailInstallationPath -string '" | 
 
 
 
 
 
 | 316 | 
 > | 
                         + fullAEpath + "'"; | 
 
 
 
 
 
 | 317 | 
 > | 
                 system(prefsCommand.c_str()); | 
 
 
 
 
 
 | 318 | 
 > | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 319 | 
   | 
 #endif | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 320 | 
   | 
                  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 321 | 
   | 
                 setStatusArea((string)"Done! Now select your mod packages and click install."); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 427 | 
   | 
                                 iter++; iter++; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 428 | 
   | 
                                 package.modStringName = *iter; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 429 | 
   | 
                                 iter++; | 
 
 
 
 
 
 
 
 
 
 
 
 | 430 | 
 < | 
                                 package.modStringVersion = atoi((*iter).c_str()); | 
 
 
 
 
 
 
 
 
 
 | 430 | 
 > | 
                                 package.modStringVersion = atof((*iter).c_str()); | 
 
 
 
 
 
 
 
 
 
 
 
 | 431 | 
   | 
                         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 432 | 
   | 
                         else if (!Platform.compare(*iter)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 433 | 
   | 
                         { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 836 | 
   | 
                 else | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 837 | 
   | 
                         return UPDATE_LOG_READ_ERR; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 838 | 
   | 
         } | 
 
 
 
 
 
 
 
 
 
 
 
 | 839 | 
 < | 
          | 
 
 
 
 
 
 
 
 
 
 | 839 | 
 > | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 840 | 
   | 
         // Is there an update folder, and is it a monthly release or a patch? | 
 
 
 
 
 
 
 
 
 
 
 
 | 841 | 
 < | 
         if (!exists("../updates/Edition")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 841 | 
 > | 
         bool firstParty = 0; | 
 
 
 
 
 
 | 842 | 
 > | 
         if (exists("../updates/Edition")) | 
 
 
 
 
 
 
 
 
 
 
 
 | 843 | 
   | 
         { | 
 
 
 
 
 
 
 
 
 | 844 | 
 + | 
                 firstParty = 1; | 
 
 
 
 
 
 
 
 
 | 845 | 
 + | 
         } | 
 
 
 
 
 
 
 
 
 | 846 | 
 + | 
         else { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 847 | 
   | 
                 strEUFN = "Edition-patch"; | 
 
 
 
 
 
 
 
 
 
 
 
 | 848 | 
 < | 
                 if (!exists("../updates/Edition-patch")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 849 | 
 < | 
                         return UPDATE_NO_UPD_AVAIL; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 848 | 
 > | 
                 if (exists("../updates/Edition-patch")) { | 
 
 
 
 
 
 | 849 | 
 > | 
                         firstParty = 1; | 
 
 
 
 
 
 | 850 | 
 > | 
                 } | 
 
 
 
 
 
 | 851 | 
 > | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 852 | 
   | 
         } | 
 
 
 
 
 
 
 
 
 
 
 
 | 853 | 
 < | 
          | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 854 | 
 < | 
         // Unlike the current AE's version info, we *need* to find the update's version info or we won't continue | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 855 | 
 < | 
         string updateCfgPath = ("../updates/" + strEUFN + "/install/packages/Globalize/Install_Info.cfg"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 856 | 
 < | 
         updateAECfg.open(updateCfgPath.c_str()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 857 | 
 < | 
         if (!updateAECfg.fail()) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 858 | 
 < | 
         { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 859 | 
 < | 
                 if (!ReadInstallInfoCfg(&updateAECfg, updateAE)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 853 | 
 > | 
  | 
 
 
 
 
 
 | 854 | 
 > | 
         if(firstParty) { | 
 
 
 
 
 
 | 855 | 
 > | 
                 // Unlike the current AE's version info, we *need* to find the update's version info or we won't continue | 
 
 
 
 
 
 | 856 | 
 > | 
                 string updateCfgPath = ("../updates/" + strEUFN + "/install/packages/Globalize/Install_Info.cfg"); | 
 
 
 
 
 
 | 857 | 
 > | 
                 updateAECfg.open(updateCfgPath.c_str()); | 
 
 
 
 
 
 | 858 | 
 > | 
                 if (!updateAECfg.fail()) | 
 
 
 
 
 
 | 859 | 
 > | 
                 { | 
 
 
 
 
 
 | 860 | 
 > | 
                         if (!ReadInstallInfoCfg(&updateAECfg, updateAE)) | 
 
 
 
 
 
 | 861 | 
 > | 
                                 return UPDATE_LOG_READ_ERR; | 
 
 
 
 
 
 | 862 | 
 > | 
  | 
 
 
 
 
 
 | 863 | 
 > | 
                         updateAECfg.close(); | 
 
 
 
 
 
 | 864 | 
 > | 
                         updateAECfg.clear(); | 
 
 
 
 
 
 | 865 | 
 > | 
                 } | 
 
 
 
 
 
 | 866 | 
 > | 
                 else | 
 
 
 
 
 
 
 
 
 
 
 
 | 867 | 
   | 
                         return UPDATE_LOG_READ_ERR; | 
 
 
 
 
 
 
 
 
 
 | 846 | 
 – | 
                  | 
 
 
 
 
 
 
 
 
 
 | 847 | 
 – | 
                 updateAECfg.close(); | 
 
 
 
 
 
 
 
 
 
 | 848 | 
 – | 
                 updateAECfg.clear(); | 
 
 
 
 
 
 
 
 
 
 | 849 | 
 – | 
         } | 
 
 
 
 
 
 
 
 
 
 | 850 | 
 – | 
         else | 
 
 
 
 
 
 
 
 
 
 | 851 | 
 – | 
                 return UPDATE_LOG_READ_ERR; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 868 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 | 869 | 
 < | 
         // Now we check for an Installer update in progress | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 870 | 
 < | 
         if (exists("Update.log")) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 871 | 
 < | 
         { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 872 | 
 < | 
                 updateLog.open("Update.log"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 873 | 
 < | 
                 if (!updateLog.fail()) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 858 | 
 < | 
                 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 859 | 
 < | 
                         vector<string> lines;  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 860 | 
 < | 
                         string line; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 861 | 
 < | 
                         int num_lines = 0; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 862 | 
 < | 
                         bool readingInstallerVersion = false, doneReadingFile = false; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 863 | 
 < | 
                          | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 864 | 
 < | 
                         while (!updateLog.eof() && !doneReadingFile) | 
 
 
 
 
 
 
 
 
 
 | 869 | 
 > | 
                 // Now we check for an Installer update in progress | 
 
 
 
 
 
 | 870 | 
 > | 
                 if (exists("Update.log")) | 
 
 
 
 
 
 | 871 | 
 > | 
                 { | 
 
 
 
 
 
 | 872 | 
 > | 
                         updateLog.open("Update.log"); | 
 
 
 
 
 
 | 873 | 
 > | 
                         if (!updateLog.fail()) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 874 | 
   | 
                         { | 
 
 
 
 
 
 
 
 
 
 
 
 | 875 | 
 < | 
                                 getline(updateLog, line); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 876 | 
 < | 
                                 lines.push_back(line); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 877 | 
 < | 
                                 num_lines++; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 878 | 
 < | 
                                 vector<string> tokens; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 879 | 
 < | 
                                 vector<string>::iterator iter; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 880 | 
 < | 
                                 tokenize(line, tokens); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 872 | 
 < | 
                                 iter = tokens.begin(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 873 | 
 < | 
                                 if (!readingInstallerVersion && tokens.capacity() >= 4) | 
 
 
 
 
 
 
 
 
 
 | 875 | 
 > | 
                                 vector<string> lines;  | 
 
 
 
 
 
 | 876 | 
 > | 
                                 string line; | 
 
 
 
 
 
 | 877 | 
 > | 
                                 int num_lines = 0; | 
 
 
 
 
 
 | 878 | 
 > | 
                                 bool readingInstallerVersion = false, doneReadingFile = false; | 
 
 
 
 
 
 | 879 | 
 > | 
  | 
 
 
 
 
 
 | 880 | 
 > | 
                                 while (!updateLog.eof() && !doneReadingFile) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 881 | 
   | 
                                 { | 
 
 
 
 
 
 
 
 
 
 
 
 | 882 | 
 < | 
                                         if (!strInstaller.compare(*iter)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 882 | 
 > | 
                                         getline(updateLog, line); | 
 
 
 
 
 
 | 883 | 
 > | 
                                         lines.push_back(line); | 
 
 
 
 
 
 | 884 | 
 > | 
                                         num_lines++; | 
 
 
 
 
 
 | 885 | 
 > | 
                                         vector<string> tokens; | 
 
 
 
 
 
 | 886 | 
 > | 
                                         vector<string>::iterator iter; | 
 
 
 
 
 
 | 887 | 
 > | 
                                         tokenize(line, tokens); | 
 
 
 
 
 
 | 888 | 
 > | 
                                         iter = tokens.begin(); | 
 
 
 
 
 
 | 889 | 
 > | 
                                         if (!readingInstallerVersion && tokens.capacity() >= 4) | 
 
 
 
 
 
 
 
 
 
 
 
 | 890 | 
   | 
                                         { | 
 
 
 
 
 
 
 
 
 
 
 
 | 891 | 
 < | 
                                                 if (!strBeing.compare(*++iter)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 892 | 
 < | 
                                                         readingInstallerVersion = true; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 893 | 
 < | 
                                                 else if (!strWas.compare(*iter)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 894 | 
 < | 
                                                         *installerJustUpdated = true; // our third indirect return value after currentAE and updateAE | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 891 | 
 > | 
                                                 if (!strInstaller.compare(*iter)) | 
 
 
 
 
 
 | 892 | 
 > | 
                                                 { | 
 
 
 
 
 
 | 893 | 
 > | 
                                                         if (!strBeing.compare(*++iter)) | 
 
 
 
 
 
 | 894 | 
 > | 
                                                                 readingInstallerVersion = true; | 
 
 
 
 
 
 | 895 | 
 > | 
                                                         else if (!strWas.compare(*iter)) | 
 
 
 
 
 
 | 896 | 
 > | 
                                                                 *installerJustUpdated = true; // our third indirect return value after currentAE and updateAE | 
 
 
 
 
 
 | 897 | 
 > | 
                                                 } | 
 
 
 
 
 
 
 
 
 
 
 
 | 898 | 
   | 
                                         } | 
 
 
 
 
 
 
 
 
 
 
 
 | 899 | 
 < | 
                                 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 883 | 
 < | 
                                 else if (readingInstallerVersion && tokens.capacity() >= 3) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 884 | 
 < | 
                                 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 885 | 
 < | 
                                         readingInstallerVersion = false; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 886 | 
 < | 
                                         string installerVersion = INSTALLER_VERSION; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 887 | 
 < | 
                                         if (installerVersion.compare(*iter)) // then the shell script-powered replacement failed | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 888 | 
 < | 
                                                 return UPDATE_INST_REPL_ERR; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 889 | 
 < | 
                                         else | 
 
 
 
 
 
 
 
 
 
 | 899 | 
 > | 
                                         else if (readingInstallerVersion && tokens.capacity() >= 3) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 900 | 
   | 
                                         { | 
 
 
 
 
 
 
 
 
 
 
 
 | 901 | 
 < | 
                                                 updateLog.close(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 902 | 
 < | 
                                                 updateLog.clear(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 903 | 
 < | 
                                                 Sleep(1000); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 904 | 
 < | 
                                                 remove("Update.log"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 905 | 
 < | 
                                                 ofstream newUpdateLog("Update.log"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 896 | 
 < | 
                                                 if (!newUpdateLog.fail()) | 
 
 
 
 
 
 
 
 
 
 | 901 | 
 > | 
                                                 readingInstallerVersion = false; | 
 
 
 
 
 
 | 902 | 
 > | 
                                                 string installerVersion = INSTALLER_VERSION; | 
 
 
 
 
 
 | 903 | 
 > | 
                                                 if (installerVersion.compare(*iter)) // then the shell script-powered replacement failed | 
 
 
 
 
 
 | 904 | 
 > | 
                                                         return UPDATE_INST_REPL_ERR; | 
 
 
 
 
 
 | 905 | 
 > | 
                                                 else | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 906 | 
   | 
                                                 { | 
 
 
 
 
 
 
 
 
 
 
 
 | 907 | 
 < | 
                                                         // Write over old log with updated information | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 908 | 
 < | 
                                                         ptime startTime(second_clock::local_time()); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 909 | 
 < | 
                                                         string strStartTime = to_simple_string(startTime); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 910 | 
 < | 
                                                         string newUpdateLine = installerVersion + " on " + strStartTime; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 911 | 
 < | 
                                                         for (int a = 0; a < lines.capacity() - 2; a++) // if there were even lines in the log before this at all | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 907 | 
 > | 
                                                         updateLog.close(); | 
 
 
 
 
 
 | 908 | 
 > | 
                                                         updateLog.clear(); | 
 
 
 
 
 
 | 909 | 
 > | 
                                                         Sleep(1000); | 
 
 
 
 
 
 | 910 | 
 > | 
                                                         remove("Update.log"); | 
 
 
 
 
 
 | 911 | 
 > | 
                                                         ofstream newUpdateLog("Update.log"); | 
 
 
 
 
 
 | 912 | 
 > | 
                                                         if (!newUpdateLog.fail()) | 
 
 
 
 
 
 
 
 
 
 
 
 | 913 | 
   | 
                                                         { | 
 
 
 
 
 
 
 
 
 
 
 
 | 914 | 
 < | 
                                                                 newUpdateLog << lines[a].c_str(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 915 | 
 < | 
                                                                 newUpdateLog << "\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 914 | 
 > | 
                                                                 // Write over old log with updated information | 
 
 
 
 
 
 | 915 | 
 > | 
                                                                 ptime startTime(second_clock::local_time()); | 
 
 
 
 
 
 | 916 | 
 > | 
                                                                 string strStartTime = to_simple_string(startTime); | 
 
 
 
 
 
 | 917 | 
 > | 
                                                                 string newUpdateLine = installerVersion + " on " + strStartTime; | 
 
 
 
 
 
 | 918 | 
 > | 
                                                                 for (int a = 0; a < lines.capacity() - 2; a++) // if there were even lines in the log before this at all | 
 
 
 
 
 
 | 919 | 
 > | 
                                                                 { | 
 
 
 
 
 
 | 920 | 
 > | 
                                                                         newUpdateLog << lines[a].c_str(); | 
 
 
 
 
 
 | 921 | 
 > | 
                                                                         newUpdateLog << "\n"; | 
 
 
 
 
 
 | 922 | 
 > | 
                                                                 } | 
 
 
 
 
 
 | 923 | 
 > | 
                                                                 newUpdateLog << "Installer was updated to:\n"; | 
 
 
 
 
 
 | 924 | 
 > | 
                                                                 newUpdateLog << newUpdateLine.c_str(); | 
 
 
 
 
 
 | 925 | 
 > | 
                                                                 *installerJustUpdated = true; // this value is indirectly returned to AEInstallerAp::OnInit() | 
 
 
 
 
 
 | 926 | 
 > | 
                                                                 doneReadingFile = true; | 
 
 
 
 
 
 | 927 | 
 > | 
                                                                 newUpdateLog.close(); | 
 
 
 
 
 
 | 928 | 
 > | 
                                                                 newUpdateLog.clear(); | 
 
 
 
 
 
 | 929 | 
 > | 
                                                                 //return UPDATE_CONT_UPD; // as noted above, we are not using this return value; in fact, we want... | 
 
 
 
 
 
 | 930 | 
 > | 
                                                                 //                                                       ...the code to continue running down through the Edition version check | 
 
 
 
 
 
 
 
 
 
 
 
 | 931 | 
   | 
                                                         } | 
 
 
 
 
 
 
 
 
 
 
 
 | 932 | 
 < | 
                                                         newUpdateLog << "Installer was updated to:\n"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 933 | 
 < | 
                                                         newUpdateLog << newUpdateLine.c_str(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 909 | 
 < | 
                                                         *installerJustUpdated = true; // this value is indirectly returned to AEInstallerAp::OnInit() | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 910 | 
 < | 
                                                         doneReadingFile = true; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 911 | 
 < | 
                                                         newUpdateLog.close(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 912 | 
 < | 
                                                         newUpdateLog.clear(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 913 | 
 < | 
                                                         //return UPDATE_CONT_UPD; // as noted above, we are not using this return value; in fact, we want... | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 914 | 
 < | 
                                                         //                                                       ...the code to continue running down through the Edition version check | 
 
 
 
 
 
 
 
 
 
 | 932 | 
 > | 
                                                         else | 
 
 
 
 
 
 | 933 | 
 > | 
                                                                 return UPDATE_LOG_READ_ERR; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 934 | 
   | 
                                                 } | 
 
 
 
 
 
 
 
 
 
 | 916 | 
 – | 
                                                 else | 
 
 
 
 
 
 
 
 
 
 | 917 | 
 – | 
                                                         return UPDATE_LOG_READ_ERR; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 935 | 
   | 
                                         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 936 | 
   | 
                                 } | 
 
 
 
 
 
 
 
 
 | 937 | 
 + | 
                                 updateLog.close(); | 
 
 
 
 
 
 
 
 
 | 938 | 
 + | 
                                 updateLog.clear(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 939 | 
   | 
                         } | 
 
 
 
 
 
 
 
 
 
 
 
 | 940 | 
 < | 
                         updateLog.close(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 941 | 
 < | 
                         updateLog.clear(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 940 | 
 > | 
                         else | 
 
 
 
 
 
 | 941 | 
 > | 
                                 return UPDATE_LOG_READ_ERR; | 
 
 
 
 
 
 | 942 | 
 > | 
                 } | 
 
 
 
 
 
 | 943 | 
 > | 
  | 
 
 
 
 
 
 | 944 | 
 > | 
                 if (updateAE->AEVersion.compare(currentAE->AEVersion) >= 1) // is the release update newer than what's installed? | 
 
 
 
 
 
 | 945 | 
 > | 
                 { | 
 
 
 
 
 
 | 946 | 
 > | 
                         if (!strEUFN.compare("Edition-patch")) // if update is a patch... | 
 
 
 
 
 
 | 947 | 
 > | 
                         { | 
 
 
 
 
 
 | 948 | 
 > | 
                                 if (currentAE->AEVersion.compare(updateAE->AEVersion.substr(0, updateAE->AEVersion.length() - 1))) // ...is it for a different month? | 
 
 
 
 
 
 | 949 | 
 > | 
                                         return UPDATE_MNTH_REQD_ERR; | 
 
 
 
 
 
 | 950 | 
 > | 
                         } | 
 
 
 
 
 
 | 951 | 
 > | 
                         string strNewInstallerPath = "../updates/" + strEUFN + "/install/" + strInstallerName; | 
 
 
 
 
 
 | 952 | 
 > | 
                         string installerVersion = INSTALLER_VERSION; | 
 
 
 
 
 
 | 953 | 
 > | 
                         if (updateAE->InstallerVersion.compare(installerVersion) >= 1) | 
 
 
 
 
 
 | 954 | 
 > | 
                         { | 
 
 
 
 
 
 | 955 | 
 > | 
                                 if (exists(strNewInstallerPath)) | 
 
 
 
 
 
 | 956 | 
 > | 
                                         return UPDATE_INST_AVAIL; | 
 
 
 
 
 
 | 957 | 
 > | 
                         } | 
 
 
 
 
 
 | 958 | 
 > | 
                         else if (updateAE->globalizationRequired) | 
 
 
 
 
 
 | 959 | 
 > | 
                                 return UPDATE_GLOB_AVAIL; | 
 
 
 
 
 
 | 960 | 
 > | 
                         else | 
 
 
 
 
 
 | 961 | 
 > | 
                                 return UPDATE_SIMP_AVAIL; | 
 
 
 
 
 
 
 
 
 
 
 
 | 962 | 
   | 
                 } | 
 
 
 
 
 
 
 
 
 
 | 924 | 
 – | 
                 else | 
 
 
 
 
 
 
 
 
 
 | 925 | 
 – | 
                         return UPDATE_LOG_READ_ERR; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 963 | 
   | 
         } | 
 
 
 
 
 
 
 
 
 
 
 
 | 964 | 
 < | 
          | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 965 | 
 < | 
         if (updateAE->AEVersion.compare(currentAE->AEVersion) >= 1) // is the release update newer than what's installed? | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 964 | 
 > | 
         try { | 
 
 
 
 
 
 | 965 | 
 > | 
         directory_iterator end; | 
 
 
 
 
 
 | 966 | 
 > | 
         if(exists("../updates")){ | 
 
 
 
 
 
 | 967 | 
 > | 
         for ( directory_iterator install_iter( "../updates" ); | 
 
 
 
 
 
 | 968 | 
 > | 
                  install_iter != end; | 
 
 
 
 
 
 | 969 | 
 > | 
                  ++install_iter ) | 
 
 
 
 
 
 
 
 
 
 
 
 | 970 | 
   | 
         { | 
 
 
 
 
 
 
 
 
 
 
 
 | 971 | 
 < | 
                 if (!strEUFN.compare("Edition-patch")) // if update is a patch... | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 972 | 
 < | 
                 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 973 | 
 < | 
                         if (currentAE->AEVersion.compare(updateAE->AEVersion.substr(0, updateAE->AEVersion.length() - 1))) // ...is it for a different month? | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 974 | 
 < | 
                                 return UPDATE_MNTH_REQD_ERR; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 971 | 
 > | 
  | 
 
 
 
 
 
 | 972 | 
 > | 
                 ModPackage installedPackage, updatePackage; | 
 
 
 
 
 
 | 973 | 
 > | 
                 if ( is_directory( install_iter->path() ) && exists( install_iter->path().string() + "/Mod_Info.cfg" ) ) { | 
 
 
 
 
 
 | 974 | 
 > | 
                         fstream file; | 
 
 
 
 
 
 | 975 | 
 > | 
                         file.open( (install_iter->path().string() + "/Mod_Info.cfg").c_str());   | 
 
 
 
 
 
 | 976 | 
 > | 
                         if (!file.fail()) | 
 
 
 
 
 
 | 977 | 
 > | 
                         { | 
 
 
 
 
 
 | 978 | 
 > | 
                                 ModPackage updatePackage = fileToModPackage(file); | 
 
 
 
 
 
 | 979 | 
 > | 
                         } | 
 
 
 
 
 
 | 980 | 
 > | 
                         else  | 
 
 
 
 
 
 | 981 | 
 > | 
                         { | 
 
 
 
 
 
 | 982 | 
 > | 
                                 file.close(); | 
 
 
 
 
 
 | 983 | 
 > | 
                                 continue; | 
 
 
 
 
 
 | 984 | 
 > | 
                         } | 
 
 
 
 
 
 | 985 | 
 > | 
                         if(!exists("packages" + install_iter->path().filename() + "/Mod_Info.cfg")); | 
 
 
 
 
 
 | 986 | 
 > | 
                         file.close(); | 
 
 
 
 
 
 | 987 | 
 > | 
                         file.open( ("packages" + install_iter->path().filename() + "/Mod_Info.cfg").c_str()); | 
 
 
 
 
 
 | 988 | 
 > | 
                         if (!file.fail()) | 
 
 
 
 
 
 | 989 | 
 > | 
                         { | 
 
 
 
 
 
 | 990 | 
 > | 
                                 ModPackage installedPackage = fileToModPackage(file); | 
 
 
 
 
 
 | 991 | 
 > | 
                         } | 
 
 
 
 
 
 | 992 | 
 > | 
                         else | 
 
 
 
 
 
 | 993 | 
 > | 
                         { | 
 
 
 
 
 
 | 994 | 
 > | 
                                 file.close(); | 
 
 
 
 
 
 | 995 | 
 > | 
                                 return UPDATE_THIRD_PARTY; | 
 
 
 
 
 
 | 996 | 
 > | 
                         } | 
 
 
 
 
 
 | 997 | 
 > | 
                         file.close(); | 
 
 
 
 
 
 | 998 | 
 > | 
                         if(updatePackage.modStringVersion > installedPackage.modStringVersion) { | 
 
 
 
 
 
 | 999 | 
 > | 
                                 return UPDATE_THIRD_PARTY; | 
 
 
 
 
 
 | 1000 | 
 > | 
                         } | 
 
 
 
 
 
 | 1001 | 
 > | 
                          | 
 
 
 
 
 
 
 
 
 
 
 
 | 1002 | 
   | 
                 } | 
 
 
 
 
 
 
 
 
 
 | 935 | 
 – | 
                 string strNewInstallerPath = "../updates/" + strEUFN + "/install/" + strInstallerName; | 
 
 
 
 
 
 
 
 
 
 | 936 | 
 – | 
                 string installerVersion = INSTALLER_VERSION; | 
 
 
 
 
 
 
 
 
 
 | 937 | 
 – | 
                 if (updateAE->InstallerVersion.compare(installerVersion) >= 1) | 
 
 
 
 
 
 
 
 
 
 | 938 | 
 – | 
                 { | 
 
 
 
 
 
 
 
 
 
 | 939 | 
 – | 
                         if (exists(strNewInstallerPath)) | 
 
 
 
 
 
 
 
 
 
 | 940 | 
 – | 
                                 return UPDATE_INST_AVAIL; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1003 | 
   | 
                 } | 
 
 
 
 
 
 
 
 
 
 
 
 | 1004 | 
 < | 
                 else if (updateAE->globalizationRequired) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1005 | 
 < | 
                         return UPDATE_GLOB_AVAIL; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1006 | 
 < | 
                 else | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1007 | 
 < | 
                         return UPDATE_SIMP_AVAIL; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1004 | 
 > | 
                  | 
 
 
 
 
 
 | 1005 | 
 > | 
         } | 
 
 
 
 
 
 | 1006 | 
 > | 
         } | 
 
 
 
 
 
 | 1007 | 
 > | 
         catch (exception & ex) { | 
 
 
 
 
 
 | 1008 | 
 > | 
         //      setStatusArea("Warning, handled exception: " + (string)ex.what()); | 
 
 
 
 
 
 
 
 
 
 
 
 | 1009 | 
   | 
         } | 
 
 
 
 
 
 
 
 
 
 | 947 | 
 – | 
         else | 
 
 
 
 
 
 
 
 
 
 | 948 | 
 – | 
                 return UPDATE_NO_UPD_AVAIL; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1010 | 
   | 
          | 
 
 
 
 
 
 
 
 
 | 1011 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1012 | 
   | 
         return UPDATE_NO_UPD_AVAIL; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1013 | 
   | 
 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1014 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1264 | 
   | 
 #endif | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1265 | 
   | 
         return true; // returning 'true' tells the Installer to quit itself ASAP so it can be replaced by the process that is now running | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1266 | 
   | 
 } | 
 
 
 
 
 
 
 
 
 | 1267 | 
 + | 
 //strPathToEUFNPackages | 
 
 
 
 
 
 
 
 
 | 1268 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 1269 | 
 + | 
 void CrawlPackages(string pathToUpdate, string strPathToPackages) { | 
 
 
 
 
 
 
 
 
 | 1270 | 
 + | 
         try{ | 
 
 
 
 
 
 
 
 
 | 1271 | 
 + | 
                 directory_iterator end; | 
 
 
 
 
 
 
 
 
 | 1272 | 
 + | 
                 for ( directory_iterator install_iter( pathToUpdate ); | 
 
 
 
 
 
 
 
 
 | 1273 | 
 + | 
                         install_iter != end; | 
 
 
 
 
 
 
 
 
 | 1274 | 
 + | 
                         ++install_iter ) | 
 
 
 
 
 
 
 
 
 | 1275 | 
 + | 
                 { | 
 
 
 
 
 
 
 
 
 | 1276 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 1277 | 
 + | 
                         ModPackage installedPackage, updatePackage; | 
 
 
 
 
 
 
 
 
 | 1278 | 
 + | 
                         string updateStr = install_iter->path().string() + "/Mod_Info.cfg"; | 
 
 
 
 
 
 
 
 
 | 1279 | 
 + | 
                         if ( !boost::iequals(install_iter->path().filename(),"Edition") | 
 
 
 
 
 
 
 
 
 | 1280 | 
 + | 
                                 && !boost::iequals(install_iter->path().filename(),"Edition-patch") | 
 
 
 
 
 
 
 
 
 | 1281 | 
 + | 
                                 && is_directory( install_iter->path() )  | 
 
 
 
 
 
 
 
 
 | 1282 | 
 + | 
                                 && exists( install_iter->path().string() + "/Mod_Info.cfg" ) )  | 
 
 
 
 
 
 
 
 
 | 1283 | 
 + | 
                         { | 
 
 
 
 
 
 
 
 
 | 1284 | 
 + | 
                                 bool update = 0; | 
 
 
 
 
 
 
 
 
 | 1285 | 
 + | 
                                 fstream file; | 
 
 
 
 
 
 
 
 
 | 1286 | 
 + | 
                                 file.open( (install_iter->path().string() + "/Mod_Info.cfg").c_str());   | 
 
 
 
 
 
 
 
 
 | 1287 | 
 + | 
                                 if (!file.fail()) | 
 
 
 
 
 
 
 
 
 | 1288 | 
 + | 
                                 { | 
 
 
 
 
 
 
 
 
 | 1289 | 
 + | 
                                         updatePackage = fileToModPackage(file); | 
 
 
 
 
 
 
 
 
 | 1290 | 
 + | 
                                 } | 
 
 
 
 
 
 
 
 
 | 1291 | 
 + | 
                                 else  | 
 
 
 
 
 
 
 
 
 | 1292 | 
 + | 
                                 { | 
 
 
 
 
 
 
 
 
 | 1293 | 
 + | 
                                         file.close(); | 
 
 
 
 
 
 
 
 
 | 1294 | 
 + | 
                                         continue; | 
 
 
 
 
 
 
 
 
 | 1295 | 
 + | 
                                 } | 
 
 
 
 
 
 
 
 
 | 1296 | 
 + | 
                                 if(!exists(strPathToPackages + "/" + install_iter->path().filename() + "/Mod_Info.cfg")); | 
 
 
 
 
 
 
 
 
 | 1297 | 
 + | 
                                 file.close(); | 
 
 
 
 
 
 
 
 
 | 1298 | 
 + | 
                                 file.clear(); | 
 
 
 
 
 
 
 
 
 | 1299 | 
 + | 
                                 file.open((strPathToPackages + "/" + install_iter->path().filename() + "/Mod_Info.cfg").c_str()); | 
 
 
 
 
 
 
 
 
 | 1300 | 
 + | 
                                 if (!file.fail()) | 
 
 
 
 
 
 
 
 
 | 1301 | 
 + | 
                                 { | 
 
 
 
 
 
 
 
 
 | 1302 | 
 + | 
                                         installedPackage = fileToModPackage(file); | 
 
 
 
 
 
 
 
 
 | 1303 | 
 + | 
                                         file.close(); | 
 
 
 
 
 
 
 
 
 | 1304 | 
 + | 
                                         if(updatePackage.modStringVersion > installedPackage.modStringVersion) { | 
 
 
 
 
 
 
 
 
 | 1305 | 
 + | 
                                                 remove_all((path)(strPathToPackages +  "/" + installedPackage.modStringName));                   | 
 
 
 
 
 
 
 
 
 | 1306 | 
 + | 
                                                 update = 1; | 
 
 
 
 
 
 
 
 
 | 1307 | 
 + | 
                                         } | 
 
 
 
 
 
 
 
 
 | 1308 | 
 + | 
                                 } | 
 
 
 
 
 
 
 
 
 | 1309 | 
 + | 
                                 else | 
 
 
 
 
 
 
 
 
 | 1310 | 
 + | 
                                 { | 
 
 
 
 
 
 
 
 
 | 1311 | 
 + | 
                                         file.close(); | 
 
 
 
 
 
 
 
 
 | 1312 | 
 + | 
                                         update = 1; | 
 
 
 
 
 
 
 
 
 | 1313 | 
 + | 
                                 } | 
 
 
 
 
 
 
 
 
 | 1314 | 
 + | 
                                 file.close(); | 
 
 
 
 
 
 
 
 
 | 1315 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 1316 | 
 + | 
                                 if(update) { | 
 
 
 
 
 
 
 
 
 | 1317 | 
 + | 
                                         rename((path)(pathToUpdate + "/" + updatePackage.modStringName), (path)(strPathToPackages + "/" + updatePackage.modStringName)); | 
 
 
 
 
 
 
 
 
 | 1318 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 1319 | 
 + | 
                                 } | 
 
 
 
 
 
 
 
 
 | 1320 | 
 + | 
                         } | 
 
 
 
 
 
 
 
 
 | 1321 | 
 + | 
                 } | 
 
 
 
 
 
 
 
 
 | 1322 | 
 + | 
         } | 
 
 
 
 
 
 
 
 
 | 1323 | 
 + | 
         catch (exception & ex) { | 
 
 
 
 
 
 
 
 
 | 1324 | 
 + | 
                 //      ex.what(); | 
 
 
 
 
 
 
 
 
 | 1325 | 
 + | 
                 setStatusArea("Warning, handled exception: " + (string)ex.what()); | 
 
 
 
 
 
 
 
 
 | 1326 | 
 + | 
         } | 
 
 
 
 
 
 
 
 
 | 1327 | 
 + | 
 } | 
 
 
 
 
 
 
 
 
 | 1328 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 1329 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 | 1330 | 
 + | 
 bool ProcessThirdPartyUpdates() { | 
 
 
 
 
 
 
 
 
 | 1331 | 
 + | 
 CrawlPackages( "../updates",  "./packages"); | 
 
 
 
 
 
 
 
 
 | 1332 | 
 + | 
 return true; | 
 
 
 
 
 
 
 
 
 | 1333 | 
 + | 
         //      globalPackages = getPackages();  | 
 
 
 
 
 
 
 
 
 | 1334 | 
 + | 
 //      refreshMods(globalInstalledMods); | 
 
 
 
 
 
 
 
 
 | 1335 | 
 + | 
 } | 
 
 
 
 
 
 
 
 
 | 1336 | 
 + | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1337 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1338 | 
   | 
 bool ProcessAEUpdate(Install_info_cfg *currentAE, Install_info_cfg *updateAE, bool *installerJustUpdated) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1339 | 
   | 
 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1499 | 
   | 
                 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1500 | 
   | 
         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1501 | 
   | 
          | 
 
 
 
 
 
 
 
 
 
 
 
 | 1502 | 
 < | 
         // Now we crawl the update's package folders for newer versions and move them over, trashing ones that are already present | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1371 | 
 < | 
         vector<ModPackage> updatePackages, currentPackages; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1372 | 
 < | 
         bool matchFound; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1373 | 
 < | 
         updatePackages.reserve(256); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1374 | 
 < | 
         currentPackages.reserve(256); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1375 | 
 < | 
          | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1376 | 
 < | 
         currentPackages = getPackages(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1377 | 
 < | 
         updatePackages = getPackages(strPathToEUFNPackages); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1378 | 
 < | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1379 | 
 < | 
         for (vector<ModPackage>::iterator iter1 = updatePackages.begin(); iter1 != updatePackages.end(); iter1++) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1380 | 
 < | 
         { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1381 | 
 < | 
                 matchFound = false; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1382 | 
 < | 
                 for (vector<ModPackage>::iterator iter2 = currentPackages.begin(); iter2 != currentPackages.end(); iter2++) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1383 | 
 < | 
                 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1384 | 
 < | 
                         if (!iter1->modStringName.compare(iter2->modStringName)) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1385 | 
 < | 
                         { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1386 | 
 < | 
                                 matchFound = true; | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1387 | 
 < | 
                                 if (iter1->modStringVersion > iter2->modStringVersion) | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1388 | 
 < | 
                                 { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1389 | 
 < | 
 #ifndef WIN32 | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1390 | 
 < | 
                                         rename((path)(strPathToPackages + iter2->modStringName), (path)(strTrashDir + iter2->modStringName)); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1391 | 
 < | 
 #else | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1392 | 
 < | 
                                         remove((path)(strPathToPackages + iter2->modStringName)); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1393 | 
 < | 
 #endif | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1394 | 
 < | 
                                         rename((path)(strPathToEUFNPackages + iter1->modStringName), (path)(strPathToPackages + iter1->modStringName)); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1395 | 
 < | 
                                 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1396 | 
 < | 
                         } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1397 | 
 < | 
                 } | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1398 | 
 < | 
                 if (!matchFound) // then there's no old package in the way, so just move in the one from the update | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1399 | 
 < | 
                         rename((path)(strPathToEUFNPackages + iter1->modStringName), (path)(strPathToPackages + iter1->modStringName)); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1400 | 
 < | 
         } | 
 
 
 
 
 
 
 
 
 
 | 1502 | 
 > | 
         CrawlPackages( strPathToEUFNPackages,  strPathToPackages); | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1503 | 
   | 
          | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1504 | 
   | 
         // 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... | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1505 | 
   | 
         // ...and folders which do not exist in the current AE will be created there | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1556 | 
   | 
                 CheckForGlobalization(true); // the 'true' value forces re-globalization | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1557 | 
   | 
          | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1558 | 
   | 
         globalPackages = getPackages(); // refresh the list in memory | 
 
 
 
 
 
 
 
 
 
 | 1457 | 
 – | 
          | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1559 | 
   | 
         // TODO: Refresh the packages list in the window | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1560 | 
   | 
  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 1561 | 
   | 
         return true; |