diff options
author | elfmz <fenix1905@tut.by> | 2022-11-10 00:32:12 +0300 |
---|---|---|
committer | elfmz <fenix1905@tut.by> | 2022-11-10 00:32:12 +0300 |
commit | c2bb0e57945e5d5d3bbea032aa804cace93d367b (patch) | |
tree | 86833f7d5670fe78af6a726a81aaef564e6fb7db | |
parent | e00ad0b5012aed794900b642de3c93ab71c45ec0 (diff) | |
parent | 0585d5883d6e28e9ad74e8129d104d88de35dc06 (diff) |
Merge branch 'master' of github.com:elfmz/far2l
-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) |