Fix for Bug #9190, -U did not work on case insensitive file systems because of call to glob convert to regex that expected to work with files.

This commit is contained in:
Bill Hoffman 2009-09-14 13:45:40 -04:00
parent 14715ce813
commit c83591e818
3 changed files with 10 additions and 5 deletions

View File

@ -416,7 +416,7 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
} }
} }
cmsys::RegularExpression regex( cmsys::RegularExpression regex(
cmsys::Glob::PatternToRegex(entryPattern.c_str(), true).c_str()); cmsys::Glob::PatternToRegex(entryPattern.c_str(), true, true).c_str());
//go through all cache entries and collect the vars which will be removed //go through all cache entries and collect the vars which will be removed
std::vector<std::string> entriesToDelete; std::vector<std::string> entriesToDelete;
cmCacheManager::CacheIterator it = cmCacheManager::CacheIterator it =

View File

@ -84,7 +84,8 @@ kwsys_stl::vector<kwsys_stl::string>& Glob::GetFiles()
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern, kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
bool require_whole_string) bool require_whole_string,
bool preserve_case)
{ {
// Incrementally build the regular expression from the pattern. // Incrementally build the regular expression from the pattern.
kwsys_stl::string regex = require_whole_string? "^" : ""; kwsys_stl::string regex = require_whole_string? "^" : "";
@ -195,10 +196,13 @@ kwsys_stl::string Glob::PatternToRegex(const kwsys_stl::string& pattern,
{ {
// On case-insensitive systems file names are converted to lower // On case-insensitive systems file names are converted to lower
// case before matching. // case before matching.
ch = tolower(ch); if(!preserve_case)
{
ch = tolower(ch);
}
} }
#endif #endif
(void)preserve_case;
// Store the character. // Store the character.
regex.append(1, static_cast<char>(ch)); regex.append(1, static_cast<char>(ch));
} }

View File

@ -79,7 +79,8 @@ public:
whole strings, but may be disabled to support concatenating whole strings, but may be disabled to support concatenating
expressions more easily (regex1|regex2|etc). */ expressions more easily (regex1|regex2|etc). */
static kwsys_stl::string PatternToRegex(const kwsys_stl::string& pattern, static kwsys_stl::string PatternToRegex(const kwsys_stl::string& pattern,
bool require_whole_string = true); bool require_whole_string = true,
bool preserve_case = false);
protected: protected:
//! Process directory //! Process directory