diff options
author | Ivan Shatsky <root@free-tier-instance.us-west1-b.c.neural-map-305409.internal> | 2022-11-09 18:13:45 +0300 |
---|---|---|
committer | Ivan Shatsky <root@free-tier-instance.us-west1-b.c.neural-map-305409.internal> | 2022-11-09 18:13:45 +0300 |
commit | 29b561259c811da473541b0ce18830aa27d3d262 (patch) | |
tree | f9e8259573569292b85d8ea1e247342685622080 /far2l/src/filemask | |
parent | 7aa83aab0760925946acfc9b50699c5c7ec7c6c4 (diff) |
Fixing recognition of pipe character as include/exclude file masks delimiter
Backported from https://github.com/shmuz/far2l/commit/1ddb8a79d6dbc204e2f4564b3c4c551ddb3447dc
Diffstat (limited to 'far2l/src/filemask')
-rw-r--r-- | far2l/src/filemask/FileMasksWithExclude.cpp | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/far2l/src/filemask/FileMasksWithExclude.cpp b/far2l/src/filemask/FileMasksWithExclude.cpp index 1fed7207..a64c2ea6 100644 --- a/far2l/src/filemask/FileMasksWithExclude.cpp +++ b/far2l/src/filemask/FileMasksWithExclude.cpp @@ -56,27 +56,31 @@ bool FileMasksWithExclude::IsExcludeMask(const wchar_t *masks) const wchar_t *FileMasksWithExclude::FindExcludeChar(const wchar_t *masks) { - const wchar_t *pExclude = masks; - - if (*pExclude == '\\') - { - pExclude++; - - while (*pExclude && (*pExclude != '\\' || *(pExclude-1) == GOOD_SLASH)) - pExclude++; - - while (*pExclude && *pExclude != EXCLUDEMASKSEPARATOR) - pExclude++; - - if (*pExclude != EXCLUDEMASKSEPARATOR) - pExclude = nullptr; - } - else + if (masks) { - pExclude = wcschr(masks,EXCLUDEMASKSEPARATOR); + for (bool regexp=false; *masks; masks++) + { + if (!regexp) + { + if (*masks == EXCLUDEMASKSEPARATOR) + return masks; + if (*masks == L'/') + regexp = true; + } + else + { + if (*masks == L'\\') + { + if (*(++masks) == 0) // skip the next char + break; + } + else if (*masks == L'/') + regexp = false; + } + } } - return pExclude; + return nullptr; } /* |