diff options
author | Oz Linden <oz@lindenlab.com> | 2011-06-23 09:47:43 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2011-06-23 09:47:43 -0400 |
commit | b343d25d19a7d21470027da379c7f16bc7fcb9fc (patch) | |
tree | 5ce5bec500d10b2d3c41752d718ad6085c93f336 /indra/llvfs/lldiriterator.cpp | |
parent | f657e8e16f539df5f57bd2fb38fbd6c69a8d6974 (diff) | |
parent | 80b81279a2b261e2eaeef86d4871090c44f42d80 (diff) |
merge changes for storm-1437
Diffstat (limited to 'indra/llvfs/lldiriterator.cpp')
-rw-r--r-- | indra/llvfs/lldiriterator.cpp | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/indra/llvfs/lldiriterator.cpp b/indra/llvfs/lldiriterator.cpp index 041436ed92..25550321f0 100644 --- a/indra/llvfs/lldiriterator.cpp +++ b/indra/llvfs/lldiriterator.cpp @@ -121,6 +121,14 @@ bool LLDirIterator::Impl::next(std::string &fname) return found; } +/** +Converts the incoming glob into a regex. This involves +converting incoming glob expressions to regex equivilents and +at the same time, escaping any regex meaningful characters which +do not have glob meaning, i.e. + .()+|^$ +in the input. +*/ std::string glob_to_regex(const std::string& glob) { std::string regex; @@ -135,9 +143,6 @@ std::string glob_to_regex(const std::string& glob) switch (c) { - case '.': - regex+="\\."; - break; case '*': if (glob.begin() == i) { @@ -170,8 +175,16 @@ std::string glob_to_regex(const std::string& glob) case '!': regex+= square_brace_open ? '^' : c; break; + case '.': // This collection have different regex meaning + case '^': // and so need escaping. + case '(': + case ')': + case '+': + case '|': + case '$': + regex += '\\'; default: - regex+=c; + regex += c; break; } |