+int LoadLogfileCommand::updateCurrent(string pattern, string type, string thisTypesCurrentFile, vector<string> filenames, map<string, string>& currentFiles){
+ try {
+
+ vector<string> patterns; m->splitAtChar(pattern, patterns, '-');
+
+ for (int i = 0; i < patterns.size(); i++) {
+
+ vector<string> peices; m->splitAtChar(patterns[i], peices, ',');
+ //cout << "patterns i = " << patterns[i] << endl;
+ if (peices.size() != 0) {
+ string tag = peices[peices.size()-1];
+ //cout << "tag = " << tag << endl;
+ if (peices[peices.size()-1] == "[extension]") { tag = m->getExtension(thisTypesCurrentFile); }
+
+ //search for the tag in the list of output files
+ for (int h = 0; h < filenames.size(); h++) {
+
+ if (m->control_pressed) { return 0; }
+ //cout << "filename h = " << filenames[h]<< endl;
+ string ending = filenames[h].substr(filenames[h].length()-tag.length(), tag.length());
+ if (ending == tag) { //if it's there and this is a type we save a current version of, save it
+ if ((type == "column") || (type == "phylip")) { //check for format
+ string RippedName = "";
+ bool foundDot = false;
+ for (int i = filenames[h].length()-1; i >= 0; i--) {
+ if (foundDot && (filenames[h][i] != '.')) { RippedName = filenames[h][i] + RippedName; }
+ else if (foundDot && (filenames[h][i] == '.')) { break; }
+ else if (!foundDot && (filenames[h][i] == '.')) { foundDot = true; }
+ }
+ if ((RippedName == "phylip") || (RippedName == "lt") || (RippedName == "square")) { currentFiles["phylip"] = filenames[h]; }
+ else { currentFiles["column"] = filenames[h]; }
+ }else { currentFiles[type] = filenames[h]; }
+ break;
+ }
+ }
+ }
+ }
+
+ return 0;
+ }
+ catch(exception& e) {
+ m->errorOut(e, "LoadLogfileCommand", "updateCurrent");
+ exit(1);
+ }
+}
+//**********************************************************************************************************************
+