| 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 |
|
{ |
| 979 |
|
fstream file; |
| 980 |
|
file.open((install_iter->path().string() + "/Mod_Info.cfg").c_str()); |
| 981 |
|
if (!file.fail()) |
| 982 |
< |
ModPackage updatePackage = fileToModPackage(file, install_iter->path().filename()); |
| 982 |
> |
updatePackage = fileToModPackage(file, install_iter->path().filename()); |
| 983 |
|
else |
| 984 |
|
{ |
| 985 |
|
file.close(); |
| 986 |
|
continue; |
| 987 |
|
} |
| 988 |
< |
if (exists("packages" + install_iter->path().filename() + "/Mod_Info.cfg")) |
| 988 |
> |
if (exists("packages/" + install_iter->path().filename() + "/Mod_Info.cfg")) |
| 989 |
|
{ |
| 990 |
|
file.close(); |
| 991 |
< |
file.open(("packages" + install_iter->path().filename() + "/Mod_Info.cfg").c_str()); |
| 991 |
> |
file.clear(); |
| 992 |
> |
file.open(("packages/" + install_iter->path().filename() + "/Mod_Info.cfg").c_str()); |
| 993 |
|
if (!file.fail()) |
| 994 |
< |
ModPackage installedPackage = fileToModPackage(file, install_iter->path().filename()); |
| 994 |
> |
installedPackage = fileToModPackage(file, install_iter->path().filename()); |
| 995 |
|
file.close(); |
| 996 |
|
if (updatePackage.modStringVersion > installedPackage.modStringVersion) |
| 997 |
|
{ |
| 1025 |
|
string strDaodanVersion = "Daodan_Version"; |
| 1026 |
|
string strOniSplitVersion = "OniSplit_Version"; |
| 1027 |
|
string strGUIWinVersion = "GUI_Win_Version"; |
| 1028 |
< |
string strGUIMacVersion = "GUI_Mac_Version"; |
| 1028 |
> |
string strGUIMacVersion = "GUI_Mac_Version"; |
| 1029 |
|
string strReglobalize = "Reglobalize"; |
| 1030 |
|
string strDeleteList = "Delete_List"; |
| 1031 |
|
string strArrow = "->"; |
| 1488 |
|
|
| 1489 |
|
globalPackages = getPackages(); // refresh the list in memory |
| 1490 |
|
// TODO: Refresh the packages list in the window |
| 1491 |
< |
|
| 1491 |
> |
wxCommandEvent e; |
| 1492 |
> |
TheWindow->OnRefreshButtonClick( e ); |
| 1493 |
|
return true; |
| 1494 |
|
} |
| 1495 |
|
|
| 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 |
|
} |
| 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 \ |