+ wxString namestr, dir, filename;
+ wxString match = wxEmptyString;
+
+ while (match == wxEmptyString)
+ {
+ wxZipEntry *entry = m_Archive->GetNextEntry();
+ if (!entry)
+ {
+ delete m_Archive;
+ m_Archive = NULL;
+ break;
+ }
+ namestr = entry->GetName(wxPATH_UNIX);
+ delete entry;
+
+ if (m_AllowDirs)
+ {
+ 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
+ }
+ }
+
+ filename = namestr.AfterLast(wxT('/'));
+ dir = namestr.BeforeLast(wxT('/'));
+ if (m_AllowFiles && !filename.empty() && m_BaseDir == dir &&
+ wxMatchWild(m_Pattern, filename, false))
+ match = m_ZipFile + wxT("#zip:") + namestr;
+ }
+
+ return match;