+
+wxString wxFileSystem::FindFirst(const wxString& spec, int flags)
+{
+ wxList::compatibility_iterator node;
+ wxString spec2(spec);
+
+ m_FindFileHandler = NULL;
+
+ for (int i = spec2.length()-1; i >= 0; i--)
+ if (spec2[(unsigned int) i] == wxT('\\')) spec2.GetWritableChar(i) = wxT('/'); // Want to be windows-safe
+
+ node = m_Handlers.GetFirst();
+ while (node)
+ {
+ wxFileSystemHandler *h = (wxFileSystemHandler*) node -> GetData();
+ if (h -> CanOpen(m_Path + spec2))
+ {
+ m_FindFileHandler = MakeLocal(h);
+ return m_FindFileHandler -> FindFirst(m_Path + spec2, flags);
+ }
+ node = node->GetNext();
+ }
+
+ node = m_Handlers.GetFirst();
+ while (node)
+ {
+ wxFileSystemHandler *h = (wxFileSystemHandler*) node -> GetData();
+ if (h -> CanOpen(spec2))
+ {
+ m_FindFileHandler = MakeLocal(h);
+ return m_FindFileHandler -> FindFirst(spec2, flags);
+ }
+ node = node->GetNext();
+ }
+
+ return wxEmptyString;
+}
+
+
+
+wxString wxFileSystem::FindNext()
+{
+ if (m_FindFileHandler == NULL) return wxEmptyString;
+ else return m_FindFileHandler -> FindNext();
+}
+
+bool wxFileSystem::FindFileInPath(wxString *pStr,
+ const wxString& path,
+ const wxString& basename)
+{
+ // we assume that it's not empty
+ wxCHECK_MSG( !basename.empty(), false,
+ _T("empty file name in wxFileSystem::FindFileInPath"));
+
+ wxString name;
+ // skip path separator in the beginning of the file name if present
+ if ( wxIsPathSeparator(basename[0u]) )
+ name = basename.substr(1);
+ else
+ name = basename;
+
+ wxStringTokenizer tokenizer(path, wxPATH_SEP);
+ while ( tokenizer.HasMoreTokens() )
+ {
+ wxString strFile = tokenizer.GetNextToken();
+ if ( !wxEndsWithPathSeparator(strFile) )
+ strFile += wxFILE_SEP_PATH;
+ strFile += name;
+
+ wxFSFile *file = OpenFile(strFile);
+ if ( file )
+ {
+ delete file;
+ *pStr = strFile;
+ return true;
+ }
+ }
+
+ return false;
+}
+