+
+
+wxString wxZipFSHandler::DoFind()
+{
+ static char namebuf[1024]; // char, not wxChar!
+ char *c;
+ wxString fn, dir, name;
+ wxString match = wxEmptyString;
+ bool wasdir;
+
+ while (match == wxEmptyString)
+ {
+ unzGetCurrentFileInfo((unzFile)m_Archive, NULL, namebuf, 1024, NULL, 0, NULL, 0);
+ for (c = namebuf; *c; c++) if (*c == '\\') *c = '/';
+ fn = namebuf;
+ if (fn.Last() == wxT('/')) {
+ fn.RemoveLast();
+ wasdir = TRUE;
+ }
+ else wasdir = FALSE;
+
+ name = fn.AfterLast(wxT('/'));
+ dir = fn.BeforeLast(wxT('/'));
+
+ if (dir == m_BaseDir) {
+ 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;
+ }
+ }
+
+ return match;
+}
+
+
+