| 27 |
|
// externs declared in installer.h |
| 28 |
|
string strInstallCfg = "../GameDataFolder/Add.cfg"; |
| 29 |
|
string strEUFN = "Edition"; // GetUpdateStatus() may set this to "Edition-patch" later, but this is the assumed name of the new Edition folder in Updates/ |
| 30 |
+ |
extern MainWindow* TheWindow; |
| 31 |
|
|
| 32 |
|
int globalizeData(void) |
| 33 |
|
{ |
| 735 |
|
copy_file(bsl_itr->path(), "../GameDataFolder/IGMD/" + dir_itr->path().filename() + "/" + bsl_itr->path().filename()); |
| 736 |
|
} |
| 737 |
|
} |
| 738 |
< |
BSLfolders.push_back( dir_itr->path().filename() ); //add back check for addon |
| 739 |
< |
BSLlog << "Pushing " << dir_itr->path().filename() << "\n" ; |
| 738 |
> |
if( !pkg.hasAddon ) { |
| 739 |
> |
BSLfolders.push_back( dir_itr->path().filename() ); //add back check for addon |
| 740 |
> |
BSLlog << "Pushing " << dir_itr->path().filename() << "\n" ; |
| 741 |
> |
} |
| 742 |
|
} |
| 743 |
|
} |
| 744 |
|
} |
| 844 |
|
return UPDATE_LOG_READ_ERR; |
| 845 |
|
} |
| 846 |
|
|
| 847 |
< |
// Is there an update folder, and is it a monthly release or a patch? |
| 847 |
> |
// Is there an update in the updates/ folder, and is it a monthly release or a patch? |
| 848 |
|
bool firstParty = 0; |
| 849 |
+ |
// First create the folder if it's missing, so users are never left wondering where updates are supposed to be put |
| 850 |
+ |
if (!exists("../updates")) |
| 851 |
+ |
create_directory("../updates"); |
| 852 |
|
if (exists("../updates/Edition")) |
| 853 |
|
{ |
| 854 |
|
firstParty = 1; |
| 984 |
|
fstream file; |
| 985 |
|
file.open((install_iter->path().string() + "/Mod_Info.cfg").c_str()); |
| 986 |
|
if (!file.fail()) |
| 987 |
< |
ModPackage updatePackage = fileToModPackage(file, install_iter->path().filename()); |
| 987 |
> |
updatePackage = fileToModPackage(file, install_iter->path().filename()); |
| 988 |
|
else |
| 989 |
|
{ |
| 990 |
|
file.close(); |
| 991 |
|
continue; |
| 992 |
|
} |
| 993 |
< |
if (exists("packages" + install_iter->path().filename() + "/Mod_Info.cfg")) |
| 993 |
> |
if (exists("packages/" + install_iter->path().filename() + "/Mod_Info.cfg")) |
| 994 |
|
{ |
| 995 |
|
file.close(); |
| 996 |
< |
file.open(("packages" + install_iter->path().filename() + "/Mod_Info.cfg").c_str()); |
| 996 |
> |
file.clear(); |
| 997 |
> |
file.open(("packages/" + install_iter->path().filename() + "/Mod_Info.cfg").c_str()); |
| 998 |
|
if (!file.fail()) |
| 999 |
< |
ModPackage installedPackage = fileToModPackage(file, install_iter->path().filename()); |
| 999 |
> |
installedPackage = fileToModPackage(file, install_iter->path().filename()); |
| 1000 |
|
file.close(); |
| 1001 |
|
if (updatePackage.modStringVersion > installedPackage.modStringVersion) |
| 1002 |
|
{ |
| 1030 |
|
string strDaodanVersion = "Daodan_Version"; |
| 1031 |
|
string strOniSplitVersion = "OniSplit_Version"; |
| 1032 |
|
string strGUIWinVersion = "GUI_Win_Version"; |
| 1033 |
< |
string strGUIMacVersion = "GUI_Mac_Version"; |
| 1033 |
> |
string strGUIMacVersion = "GUI_Mac_Version"; |
| 1034 |
|
string strReglobalize = "Reglobalize"; |
| 1035 |
|
string strDeleteList = "Delete_List"; |
| 1036 |
|
string strArrow = "->"; |
| 1492 |
|
CheckForGlobalization(true); // the 'true' value forces re-globalization |
| 1493 |
|
|
| 1494 |
|
globalPackages = getPackages(); // refresh the list in memory |
| 1495 |
< |
// TODO: Refresh the packages list in the window |
| 1496 |
< |
|
| 1495 |
> |
wxCommandEvent e; |
| 1496 |
> |
TheWindow->OnRefreshButtonClick( e ); |
| 1497 |
|
return true; |
| 1498 |
|
} |
| 1499 |
|
|
| 1547 |
|
if (!file.fail()) |
| 1548 |
|
{ |
| 1549 |
|
installedPackage = fileToModPackage(file, updtFolder); |
| 1550 |
< |
file.close(); |
| 1551 |
< |
if (updatePackage.modStringVersion > installedPackage.modStringVersion) |
| 1552 |
< |
{ |
| 1553 |
< |
if (updatePackage.installerVersion <= INSTALLER_VERSION) |
| 1554 |
< |
{ |
| 1550 |
> |
} |
| 1551 |
> |
file.close(); |
| 1552 |
> |
} |
| 1553 |
> |
file.close(); |
| 1554 |
> |
if (updatePackage.modStringVersion > installedPackage.modStringVersion) |
| 1555 |
> |
{ |
| 1556 |
> |
if (updatePackage.installerVersion <= INSTALLER_VERSION) |
| 1557 |
> |
{ |
| 1558 |
> |
if(exists(strPathToPackages + "/" + updatePackage.modStringName)) { |
| 1559 |
|
#ifdef WIN32 |
| 1560 |
< |
remove_all((path)(strPathToPackages + "/" + installedPackage.modStringName)); |
| 1560 |
> |
remove_all((path)(strPathToPackages + "/" + updatePackage.modStringName)); |
| 1561 |
|
#else |
| 1562 |
< |
if (needNewTrashDir) |
| 1563 |
< |
{ |
| 1564 |
< |
strTrashDir = strTrashDir + "Old_packages_" + boost::lexical_cast<string>(tmStartTime.tm_hour) + "-" + |
| 1565 |
< |
boost::lexical_cast<string>(tmStartTime.tm_min) + "-" + boost::lexical_cast<string>(tmStartTime.tm_sec) + "/"; |
| 1566 |
< |
create_directory(strTrashDir); |
| 1567 |
< |
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)); |
| 1562 |
> |
if (needNewTrashDir) |
| 1563 |
> |
{ |
| 1564 |
> |
strTrashDir = strTrashDir + "Old_packages_" + boost::lexical_cast<string>(tmStartTime.tm_hour) + "-" + |
| 1565 |
> |
boost::lexical_cast<string>(tmStartTime.tm_min) + "-" + boost::lexical_cast<string>(tmStartTime.tm_sec) + "/"; |
| 1566 |
> |
create_directory(strTrashDir); |
| 1567 |
> |
needNewTrashDir = false; |
| 1568 |
|
} |
| 1569 |
+ |
rename((path)(strPathToPackages + "/" + updatePackage.modStringName), (path)(strTrashDir + updatePackage.modStringName)); |
| 1570 |
+ |
#endif |
| 1571 |
|
} |
| 1572 |
+ |
rename((path)(pathToUpdate + "/" + updatePackage.modStringName), (path)(strPathToPackages + "/" + updatePackage.modStringName)); |
| 1573 |
|
} |
| 1564 |
– |
else |
| 1565 |
– |
file.close(); |
| 1574 |
|
} |
| 1567 |
– |
file.close(); |
| 1568 |
– |
file.clear(); |
| 1575 |
|
} |
| 1576 |
|
} |
| 1577 |
|
} |
| 1579 |
|
{ |
| 1580 |
|
setStatusArea("Warning, handled exception: " + (string)ex.what()); |
| 1581 |
|
} |
| 1582 |
+ |
wxCommandEvent e; |
| 1583 |
+ |
TheWindow->OnRefreshButtonClick( e ); |
| 1584 |
|
} |
| 1585 |
|
|
| 1586 |
|
/* MakePathLocalToGlobalize is a function used once by ProcessAEUpdate() that takes a file in an \ |