diff options
author | Chris Wilson <chris+github@qwirx.com> | 2011-12-03 23:07:41 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2011-12-03 23:07:41 +0000 |
commit | 4220d1bde508875d96036f04a1c62fab4742733b (patch) | |
tree | 2faaaa6c9382053be552e5524b586209416a5745 /lib | |
parent | 27c38db30ace9b4267d0018afb5d431a3b213955 (diff) |
Fix regex case issues on Windows (\S converted to \s for example). Ensure that
filename comparison is always case insensitive on Windows, by convention.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/common/ExcludeList.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/common/ExcludeList.cpp b/lib/common/ExcludeList.cpp index edbf1a6a..213c4f8e 100644 --- a/lib/common/ExcludeList.cpp +++ b/lib/common/ExcludeList.cpp @@ -101,11 +101,6 @@ std::string ExcludeList::ReplaceSlashesRegex(const std::string& input) const output.replace(pos, 1, "\\" DIRECTORY_SEPARATOR); } - for (std::string::iterator i = output.begin(); i != output.end(); i++) - { - *i = tolower(*i); - } - return output; } #endif @@ -185,17 +180,19 @@ void ExcludeList::AddRegexEntries(const std::string &rEntries) try { std::string entry = *i; + int flags = REG_EXTENDED | REG_NOSUB; // Convert any forward slashes in the string // to appropriately escaped backslashes #ifdef WIN32 entry = ReplaceSlashesRegex(entry); + flags |= REG_ICASE; // Windows convention #endif // Compile - int errcode = ::regcomp(pregex, entry.c_str(), - REG_EXTENDED | REG_NOSUB); + int errcode = ::regcomp(pregex, entry.c_str(), + flags); if (errcode != 0) { @@ -238,6 +235,7 @@ bool ExcludeList::IsExcluded(const std::string &rTest) const std::string test = rTest; #ifdef WIN32 + // converts to lower case as well test = ReplaceSlashesDefinite(test); #endif |