mirror of
https://github.com/glest/glest-source.git
synced 2025-08-28 18:29:48 +02:00
- segfault bugfix for techtree validation
This commit is contained in:
@@ -1661,6 +1661,8 @@ void runTechValidationForPath(string techPath, string techName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(purgeDuplicateFiles == true) {
|
if(purgeDuplicateFiles == true) {
|
||||||
|
//printf("\nPurge Duplicate Files detected - START:\n=====================\n");
|
||||||
|
|
||||||
string newCommonFileName = "";
|
string newCommonFileName = "";
|
||||||
for(unsigned int idx = 0; idx < fileList.size(); ++idx) {
|
for(unsigned int idx = 0; idx < fileList.size(); ++idx) {
|
||||||
string duplicateFile = fileList[idx];
|
string duplicateFile = fileList[idx];
|
||||||
@@ -1752,8 +1754,12 @@ void runTechValidationForPath(string techPath, string techName,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//printf("\nPurge Duplicate Files detected - END:\n=====================\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
//printf("\nPurge Duplicate Files DISABLED - START:\n=====================\n");
|
||||||
|
|
||||||
string newCommonFileName = "";
|
string newCommonFileName = "";
|
||||||
for(unsigned int idx = 0; idx < fileList.size(); ++idx) {
|
for(unsigned int idx = 0; idx < fileList.size(); ++idx) {
|
||||||
string duplicateFile = fileList[idx];
|
string duplicateFile = fileList[idx];
|
||||||
@@ -1766,6 +1772,9 @@ void runTechValidationForPath(string techPath, string techName,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//printf("\nPurge Duplicate Files #2 DISABLED [%lu] - START:\n=====================\n",fileList.size());
|
||||||
|
|
||||||
for(unsigned int idx = 0; idx < fileList.size(); ++idx) {
|
for(unsigned int idx = 0; idx < fileList.size(); ++idx) {
|
||||||
string duplicateFile = fileList[idx];
|
string duplicateFile = fileList[idx];
|
||||||
string fileExt = extractExtension(duplicateFile);
|
string fileExt = extractExtension(duplicateFile);
|
||||||
@@ -1775,13 +1784,31 @@ void runTechValidationForPath(string techPath, string techName,
|
|||||||
for(unsigned int jdx = 0; jdx < iterFind4->second.size(); jdx++) {
|
for(unsigned int jdx = 0; jdx < iterFind4->second.size(); jdx++) {
|
||||||
string parentFile = iterFind4->second[jdx].first;
|
string parentFile = iterFind4->second[jdx].first;
|
||||||
string searchText = iterFind4->second[jdx].second;
|
string searchText = iterFind4->second[jdx].second;
|
||||||
|
replaceAll(searchText, "//", "/");
|
||||||
|
replaceAll(parentFile, "//", "/");
|
||||||
|
replaceAll(searchText, "\\\\", "\\");
|
||||||
|
replaceAll(parentFile, "\\\\", "\\");
|
||||||
|
|
||||||
//printf("*** Searching parent file:\n[%s]\nfor duplicate file reference:\n[%s]\nto replace with newname:\n[%s]\n",parentFile.c_str(),searchText.c_str(),newCommonFileName.c_str());
|
//printf("*** Searching parent file:\n[%s]\nfor duplicate file reference:\n[%s]\nto replace with newname:\n[%s]\n",parentFile.c_str(),searchText.c_str(),newCommonFileName.c_str());
|
||||||
bool foundText = searchAndReplaceTextInFile(parentFile, searchText, newCommonFileName, true);
|
bool foundText = searchAndReplaceTextInFile(parentFile, searchText, newCommonFileName, true);
|
||||||
//printf("foundText = %d\n",foundText);
|
//printf("foundText = %d\n",foundText);
|
||||||
if(foundText == false) {
|
if(foundText == false) {
|
||||||
char szBuf[4096]="";
|
string techCommonData = techPath + techName + "/commondata/";
|
||||||
sprintf(szBuf,"Error finding text [%s] in file [%s]",searchText.c_str(),parentFile.c_str());
|
replaceAll(techCommonData, "//", "/");
|
||||||
|
|
||||||
|
//printf("ERROR techCommonData check\n[%s]\n[%s]\n",techCommonData.c_str(),searchText.c_str());
|
||||||
|
|
||||||
|
if(StartsWith(searchText, techCommonData) == true) {
|
||||||
|
replaceAll(searchText, techCommonData, "$COMMONDATAPATH/");
|
||||||
|
foundText = searchAndReplaceTextInFile(parentFile, searchText, newCommonFileName, true);
|
||||||
|
}
|
||||||
|
if(foundText == false) {
|
||||||
|
//printf("Error finding text [%s] in file [%s]",searchText.c_str(),parentFile.c_str());
|
||||||
|
|
||||||
|
char szBuf[8096]="";
|
||||||
|
sprintf(szBuf,"Error finding text\n[%s]\nin file\n[%s]\nnew Common File [%s]\n",searchText.c_str(),parentFile.c_str(),newCommonFileName.c_str());
|
||||||
|
printf("\n\n=================================================\n%s",szBuf);
|
||||||
|
|
||||||
throw runtime_error(szBuf);
|
throw runtime_error(szBuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1789,6 +1816,9 @@ void runTechValidationForPath(string techPath, string techName,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//printf("\nPurge Duplicate Files DISABLED - END:\n=====================\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(foundDuplicates == true) {
|
if(foundDuplicates == true) {
|
||||||
|
Reference in New Issue
Block a user