updated compressor to skip non mode game data by default unless additional parameter specified

This commit is contained in:
Mark Vejvoda 2013-11-14 23:18:28 +00:00
parent e3245eb7f4
commit 445e39ab2d
2 changed files with 34 additions and 5 deletions

View File

@ -3501,6 +3501,10 @@ int handleCreateDataArchivesCommand(int argc, char** argv) {
Tokenize(paramValue,paramPartTokens,"=");
if(paramPartTokens.size() >= 2 && paramPartTokens[1].length() > 0) {
string compress_item = paramPartTokens[1];
bool includeMainData = false;
if(paramPartTokens.size() >= 3 && paramPartTokens[2] == "include_main") {
includeMainData = true;
}
Config &config = Config::getInstance();
string fileArchiveExtension = config.getString("FileArchiveExtension","");
@ -3508,6 +3512,11 @@ int handleCreateDataArchivesCommand(int argc, char** argv) {
string fileArchiveCompressCommandParameters = config.getString("FileArchiveCompressCommandParameters","");
int32 fileArchiveCompressCommandSuccessResult = config.getInt("FileArchiveCompressCommandSuccessResult","0");
string userData = config.getString("UserData_Root","");
if(userData != "") {
endPathWithSlash(userData);
}
int typesSelected = 0;
if(compress_item == "techtrees" || compress_item == "all") {
typesSelected++;
@ -3525,10 +3534,20 @@ int handleCreateDataArchivesCommand(int argc, char** argv) {
if(techPath != "") {
endPathWithSlash(techPath);
}
vector<string> results2;
findDirs(techPath + name + "/factions", results2, false,true);
if(results2.empty() == false) {
string downloadArchive = techPath + name + fileArchiveExtension;
string techtreePath = techPath + name;
if(includeMainData == false) {
//printf("userData [%s] techPath [%s]\n",userData.c_str(),techtreePath.c_str());
if(techtreePath.find(userData) == techPath.npos) {
printf("Skipping techtree: [%s]\n",techtreePath.c_str());
continue;
}
}
string downloadArchive = techtreePath + fileArchiveExtension;
//printf("Test downloadArchive [%s]\n",downloadArchive.c_str());
@ -3541,7 +3560,7 @@ int handleCreateDataArchivesCommand(int argc, char** argv) {
string compressCmd = getFullFileArchiveCompressCommand(
fileArchiveCompressCommand,
fileArchiveCompressCommandParameters,
downloadArchive,techPath + name );
downloadArchive,techtreePath );
printf("Running compression command: %s\n",compressCmd.c_str());
@ -3576,8 +3595,17 @@ int handleCreateDataArchivesCommand(int argc, char** argv) {
if(tilesetPath != "") {
endPathWithSlash(tilesetPath);
}
if(fileExists(tilesetPath + name + "/" + name + ".xml") == true) {
string downloadArchive = tilesetPath + name + fileArchiveExtension;
string tilesetDataPath = tilesetPath + name;
if(includeMainData == false) {
if(tilesetPath.find(userData) == tilesetPath.npos) {
printf("Skipping tileset data: [%s]\n",tilesetDataPath.c_str());
continue;
}
}
string downloadArchive = tilesetDataPath + fileArchiveExtension;
//printf("Test downloadArchive [%s]\n",downloadArchive.c_str());
@ -3590,7 +3618,7 @@ int handleCreateDataArchivesCommand(int argc, char** argv) {
string compressCmd = getFullFileArchiveCompressCommand(
fileArchiveCompressCommand,
fileArchiveCompressCommandParameters,
downloadArchive,tilesetPath + name );
downloadArchive,tilesetDataPath );
printf("Running compression command: %s\n",compressCmd.c_str());

View File

@ -481,9 +481,10 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) {
printf("\n%s\t\tdisables opengl capability checks (for corrupt or flaky video drivers).",GAME_ARGS[GAME_ARG_DISABLE_OPENGL_CAPS_CHECK]);
printf("\n%s=x\t\t\tcompress selected game data into archives for network sharing.",GAME_ARGS[GAME_ARG_CREATE_DATA_ARCHIVES]);
printf("\n%s=x=y\t\t\tcompress selected game data into archives for network sharing.",GAME_ARGS[GAME_ARG_CREATE_DATA_ARCHIVES]);
printf("\n \t\tWhere x is one of the following data items to compress.");
printf("\n \t\ttechtrees, tilesets or all.");
printf("\n \t\tWhere y = include_main to include main (non mod) data.");
printf("\n \t\texample: %s %s=all",extractFileFromDirectoryPath(argv0).c_str(),GAME_ARGS[GAME_ARG_CREATE_DATA_ARCHIVES]);
printf("\n%s\t\t\tdisplays verbose information in the console.",GAME_ARGS[GAME_ARG_VERBOSE_MODE]);