- if (m_AllowFiles && !wasdir && wxMatchWild(m_Pattern, name, FALSE))
- match = m_ZipFile + wxT("#zip:") + fn;
- if (m_AllowDirs && wasdir && wxMatchWild(m_Pattern, name, FALSE))
- match = m_ZipFile + wxT("#zip:") + fn;
- }
-
- if (unzGoToNextFile((unzFile)m_Archive) != UNZ_OK)
- {
- unzClose((unzFile)m_Archive);
- m_Archive = NULL;
- break;
+ dir = namestr.BeforeLast(wxT('/'));
+ while (!dir.empty())
+ {
+ if( m_DirsFound->find(dir) == m_DirsFound->end() )
+ {
+ (*m_DirsFound)[dir] = 1;
+ filename = dir.AfterLast(wxT('/'));
+ dir = dir.BeforeLast(wxT('/'));
+ if (!filename.empty() && m_BaseDir == dir &&
+ wxMatchWild(m_Pattern, filename, false))
+ match = m_ZipFile + wxT("#zip:") + dir + wxT("/") + filename;
+ }
+ else
+ break; // already tranversed
+ }