| 14 | |
| 15 | |
| 16 | bool CommandData::CheckArgs(StringList *Args,bool Dir,const wchar *CheckName,bool CheckFullPath,int MatchMode) |
| 17 | { |
| 18 | wchar *Name=ConvertPath(CheckName,NULL,0); |
| 19 | wchar FullName[NM]; |
| 20 | wchar CurMask[NM]; |
| 21 | *FullName=0; |
| 22 | Args->Rewind(); |
| 23 | while (Args->GetString(CurMask,ASIZE(CurMask))) |
| 24 | { |
| 25 | wchar *LastMaskChar=PointToLastChar(CurMask); |
| 26 | bool DirMask=IsPathDiv(*LastMaskChar); // Mask for directories only. |
| 27 | |
| 28 | if (Dir) |
| 29 | { |
| 30 | // CheckName is a directory. |
| 31 | if (DirMask) |
| 32 | { |
| 33 | // We process the directory and have the directory exclusion mask. |
| 34 | // So let's convert "mask\" to "mask" and process it normally. |
| 35 | |
| 36 | *LastMaskChar=0; |
| 37 | } |
| 38 | else |
| 39 | { |
| 40 | // REMOVED, we want -npath\* to match empty folders too. |
| 41 | // If mask has wildcards in name part and does not have the trailing |
| 42 | // '\' character, we cannot use it for directories. |
| 43 | |
| 44 | // if (IsWildcard(PointToName(CurMask))) |
| 45 | // continue; |
| 46 | } |
| 47 | } |
| 48 | else |
| 49 | { |
| 50 | // If we process a file inside of directory excluded by "dirmask\". |
| 51 | // we want to exclude such file too. So we convert "dirmask\" to |
| 52 | // "dirmask\*". It is important for operations other than archiving |
| 53 | // with -x. When archiving with -x, directory matched by "dirmask\" |
| 54 | // is excluded from further scanning. |
| 55 | |
| 56 | if (DirMask) |
| 57 | wcsncatz(CurMask,L"*",ASIZE(CurMask)); |
| 58 | } |
| 59 | |
| 60 | #ifndef SFX_MODULE |
| 61 | if (CheckFullPath && IsFullPath(CurMask)) |
| 62 | { |
| 63 | // We do not need to do the special "*\" processing here, because |
| 64 | // unlike the "else" part of this "if", now we convert names to full |
| 65 | // format, so they all include the path, which is matched by "*\" |
| 66 | // correctly. Moreover, removing "*\" from mask would break |
| 67 | // the comparison, because now all names have the path. |
| 68 | |
| 69 | if (*FullName==0) |
| 70 | ConvertNameToFull(CheckName,FullName,ASIZE(FullName)); |
| 71 | if (CmpName(CurMask,FullName,MatchMode)) |
| 72 | return true; |
| 73 | } |
nothing calls this directly
no test coverage detected