@@ -176,14 +176,27 @@ LIB7ZRC MLListArchive(std::wstring archiveNameW, std::vector<DirectoryItem> &ret
176
176
return 0 ;
177
177
}
178
178
179
- bool DoesNameMatchWildcards (UString name, std::vector<std::wstring> exclusionWildcards) {
179
+ bool DoesNameMatchWildcards (UString name,
180
+ std::vector<std::wstring> &exclusionWildcards,
181
+ std::vector<UString> &removedPathes) {
180
182
181
183
for (std::vector<std::wstring>::iterator it = exclusionWildcards.begin ();
182
184
it < exclusionWildcards.end (); it++)
183
185
{
184
186
UString nameOnly = ExtractFileNameFromPath (name);
185
187
bool match = DoesWildcardMatchName (it->c_str (), nameOnly);
186
- if (match) return true ;
188
+ if (match) {
189
+ removedPathes.push_back (name);
190
+ return true ;
191
+ }
192
+ }
193
+
194
+ // now check if the item is not inside of already removed folder
195
+ for (std::vector<UString>::iterator it = removedPathes.begin ();
196
+ it < removedPathes.end (); it++)
197
+ {
198
+ bool found = name.IsPrefixedBy ((*it + L" /" ));
199
+ if (found) return true ;
187
200
}
188
201
return false ;
189
202
}
@@ -242,12 +255,13 @@ LIB7ZRC MLExtractFromArchive(std::wstring archiveNameW, std::wstring outDirW,
242
255
files2.push_back (*it + L" /" );
243
256
}
244
257
258
+ std::vector<UString> removedPathes;
245
259
for (UInt32 i = 0 ; i < numItems; i++)
246
260
{
247
261
UString filePath;
248
262
RINOK (arc.GetItemPath (i, filePath));
249
263
250
- if (DoesNameMatchWildcards (filePath, exclusionWildcards)) continue ;
264
+ if (DoesNameMatchWildcards (filePath, exclusionWildcards, removedPathes )) continue ;
251
265
252
266
if (files.size ())
253
267
{
0 commit comments