Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/elfmz/far2l.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Shatsky <root@free-tier-instance.us-west1-b.c.neural-map-305409.internal>2022-11-09 18:13:45 +0300
committerIvan Shatsky <root@free-tier-instance.us-west1-b.c.neural-map-305409.internal>2022-11-09 18:13:45 +0300
commit29b561259c811da473541b0ce18830aa27d3d262 (patch)
treef9e8259573569292b85d8ea1e247342685622080
parent7aa83aab0760925946acfc9b50699c5c7ec7c6c4 (diff)
Fixing recognition of pipe character as include/exclude file masks delimiter
Backported from https://github.com/shmuz/far2l/commit/1ddb8a79d6dbc204e2f4564b3c4c551ddb3447dc
-rw-r--r--far2l/src/filemask/FileMasksWithExclude.cpp40
-rw-r--r--far2l/src/mix/processname.cpp18
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)