- // Find path only so we can concatenate
- // found file onto path
- char *p = wxPathOnly(wxFileSpec);
- char *n = wxFileNameFromPath(wxFileSpec);
+#ifndef __VMS__
+ wxCHECK_MSG( gs_dirStream, result, wxT("must call wxFindFirstFile first") );
+
+ // Find path only so we can concatenate
+ // found file onto path
+ wxString path(wxPathOnly(gs_strFileSpec));
+ wxString name(wxFileNameFromPath(gs_strFileSpec));
+
+ /* MATTHEW: special case: path is really "/" */
+ if ( !path && gs_strFileSpec[0u] == wxT('/'))
+ path = wxT('/');
+
+ // Do the reading
+ struct dirent *nextDir;
+ for ( nextDir = readdir(gs_dirStream);
+ nextDir != NULL;
+ nextDir = readdir(gs_dirStream) )
+ {
+ if (wxMatchWild(name, nextDir->d_name))
+ {
+ result.Empty();
+ if ( !path.IsEmpty() )
+ {
+ result = path;
+ if ( path != wxT('/') )
+ result += wxT('/');
+ }