diff options
-rw-r--r-- | far2l/src/filemask/FileMasksWithExclude.cpp | 40 | ||||
-rw-r--r-- | far2l/src/mix/processname.cpp | 18 |
2 files changed, 25 insertions, 33 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; } /* diff --git a/far2l/src/mix/processname.cpp b/far2l/src/mix/processname.cpp index 64c28f9f..2cbaafbb 100644 --- a/far2l/src/mix/processname.cpp +++ b/far2l/src/mix/processname.cpp @@ -37,6 +37,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "processname.hpp" #include "strmix.hpp" #include "pathmix.hpp" +#include "CFileMask.hpp" // обработать имя файла: сравнить с маской, масками, сгенерировать по маске int WINAPI ProcessName(const wchar_t *param1, wchar_t *param2, DWORD size, DWORD flags) @@ -50,21 +51,8 @@ int WINAPI ProcessName(const wchar_t *param1, wchar_t *param2, DWORD size, DWORD if (flags == PN_CMPNAMELIST) { - int Found=FALSE; - FARString strFileMask; - const wchar_t *MaskPtr; - MaskPtr=param1; - - while ((MaskPtr=GetCommaWord(MaskPtr,strFileMask))) - { - if (CmpName(strFileMask,param2,skippath)) - { - Found=TRUE; - break; - } - } - - return Found; + CFileMask Masks; + return Masks.Set(param1,FMF_SILENT) && Masks.Compare(skippath ? PointToName(param2):param2); } if (flags&PN_GENERATENAME) |