Prints a warning if a keyword that has already been added, occurs again. Next step, process keywords from several ordered, top-level folders
This commit is contained in:
parent
94306e6fdc
commit
b8f87a1eb1
@ -198,11 +198,21 @@ static void generateKeywordSource(const char * source_file_name , KeywordMapType
|
|||||||
//-----------------------------------------------------------------
|
//-----------------------------------------------------------------
|
||||||
|
|
||||||
static void scanKeyword(const boost::filesystem::path& file , KeywordMapType& keywordMap) {
|
static void scanKeyword(const boost::filesystem::path& file , KeywordMapType& keywordMap) {
|
||||||
if (!ParserKeyword::validInternalName(file.filename().string())) {
|
std::cerr << "Scanning file: " << file.string() << std::endl;
|
||||||
|
|
||||||
|
std::string internalName = file.filename().string();
|
||||||
|
if (!ParserKeyword::validInternalName(internalName)) {
|
||||||
std::cerr << "Warning: Ignoring incorrectly named file '" << file.string() << "'.\n";
|
std::cerr << "Warning: Ignoring incorrectly named file '" << file.string() << "'.\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KeywordMapType::iterator existingEntry = keywordMap.find(internalName);
|
||||||
|
bool alreadyExists = existingEntry != keywordMap.end();
|
||||||
|
if (alreadyExists) {
|
||||||
|
std::cerr << "Warning: Ignoring the the keyword " << internalName << " in '" << file.string()
|
||||||
|
<< "', it has already been read from '" << existingEntry->second.first << "'" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
Json::JsonObject * jsonKeyword;
|
Json::JsonObject * jsonKeyword;
|
||||||
try {
|
try {
|
||||||
jsonKeyword = new Json::JsonObject(file);
|
jsonKeyword = new Json::JsonObject(file);
|
||||||
@ -226,6 +236,7 @@ static void scanKeyword(const boost::filesystem::path& file , KeywordMapType& ke
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void scanAllKeywords(const boost::filesystem::path& directory , KeywordMapType& keywordMap) {
|
static void scanAllKeywords(const boost::filesystem::path& directory , KeywordMapType& keywordMap) {
|
||||||
|
std::cerr << "Scanning path: " << directory.string() << std::endl;
|
||||||
boost::filesystem::directory_iterator end;
|
boost::filesystem::directory_iterator end;
|
||||||
for (boost::filesystem::directory_iterator iter(directory); iter != end; iter++) {
|
for (boost::filesystem::directory_iterator iter(directory); iter != end; iter++) {
|
||||||
if (boost::filesystem::is_directory(*iter))
|
if (boost::filesystem::is_directory(*iter))
|
||||||
|
Loading…
Reference in New Issue
Block a user