From c83591e81876505396a6a46cee39e32d5d289f4c Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Mon, 14 Sep 2009 13:45:40 -0400 Subject: [PATCH] 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. --- Source/cmake.cxx | 2 +- Source/kwsys/Glob.cxx | 10 +++++++--- Source/kwsys/Glob.hxx.in | 3 ++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index a3555b9f2..ba16d3bb2 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -416,7 +416,7 @@ bool cmake::SetCacheArgs(const std::vector& args) } } 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 std::vector entriesToDelete; cmCacheManager::CacheIterator it = diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx index 21efca8ec..b34b47371 100644 --- a/Source/kwsys/Glob.cxx +++ b/Source/kwsys/Glob.cxx @@ -84,7 +84,8 @@ kwsys_stl::vector& Glob::GetFiles() //---------------------------------------------------------------------------- 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. 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 // case before matching. - ch = tolower(ch); + if(!preserve_case) + { + ch = tolower(ch); + } } #endif - + (void)preserve_case; // Store the character. regex.append(1, static_cast(ch)); } diff --git a/Source/kwsys/Glob.hxx.in b/Source/kwsys/Glob.hxx.in index fb4eac6a6..638f45890 100644 --- a/Source/kwsys/Glob.hxx.in +++ b/Source/kwsys/Glob.hxx.in @@ -79,7 +79,8 @@ public: whole strings, but may be disabled to support concatenating expressions more easily (regex1|regex2|etc). */ 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: //! Process directory