//================================================================================================================ vector<string> CGlobal::CacheNames(string filepath) { char* in_path = new char[strlen(filepath.c_str()) + 1]; strcpy_s(in_path, strlen(filepath.c_str()) + 1, filepath.c_str()); vector<string> names = CGlobal::GetFilenames(in_path, ""); FileParser parser; vector<string> p_valuesToRemove; //if there is a name without a .* then remove it for (int i = 0; i < names.size(); i++) { parser.ResetCurrentPos(); string name = names[i]; char* in_path = new char[strlen(name.c_str()) + 1]; strcpy_s(in_path, strlen(name.c_str()) + 1, name.c_str()); bool containsPeriod = false; int val; while ((val = parser.FindToken(in_path, true)) != -1) { if (val == PERIOD) { containsPeriod = true; break; } } if (!containsPeriod) { p_valuesToRemove.push_back(name); } } if (p_valuesToRemove.size() > 0) { vector<string> temp_names; vector<string>::iterator it = names.begin(); for (; it != names.end(); it++) { for (int i = 0; i < p_valuesToRemove.size(); i++) { bool good = true; for (int t = 0; t < p_valuesToRemove.size(); t++) { if ((*it) == p_valuesToRemove[t]) { good = false; } } if (good) { bool exists = false; for (int j = 0; j < temp_names.size(); j++) { if ((*it) == temp_names[j]) { exists = true; break; } } if (!exists) { temp_names.push_back((*it)); break; } } else break; } } if (names.size() > 0) names.clear(); for (int i = 0; i < temp_names.size(); i++) { names.push_back(temp_names[i]); } } return names; }