wxDir::GetFirstFile syntax for filespec

168 views
Skip to first unread message

Otto Wyss

unread,
Dec 1, 2003, 3:31:55 PM12/1/03
to wx-u...@lists.wxwindows.org

I can't find what's allowed for the filespec parameter. Does anyone
know? Is it documented anywhere?

O. Wyss

--
See "http://wxguide.sourceforge.net/" for ideas how to design your app.

Kevin Hock

unread,
Dec 1, 2003, 3:48:03 PM12/1/03
to wx-u...@lists.wxwindows.org
I use something like "*.zip" in my code, I so I would assume things like ?
are supported too.

Why not just try it and find out? :-D

Kevin

Otto Wyss

unread,
Dec 1, 2003, 4:33:48 PM12/1/03
to wx-u...@lists.wxwindows.org

"Kevin Hock" <hoc...@yahoo.com> wrote:

> I use something like "*.zip" in my code, I so I would assume things like ?
> are supported too.
>
> Why not just try it and find out? :-D
>

I tried "*.cpp;*.h", "*.cpp|*.h" they both doesn't seem to work.

Kevin Hock

unread,
Dec 1, 2003, 5:13:26 PM12/1/03
to wx-u...@lists.wxwindows.org
Otto,

This code works fine for me:

wxArrayString SkinFiles;
const wxString FileSpec = _T("*.zip");
const int flags = wxDIR_FILES;

if (m_SkinsDirectory != wxEmptyString && wxDirExists(m_SkinsDirectory))
{
// Get all .zip files
wxDir::GetAllFiles(m_SkinsDirectory, &SkinFiles, FileSpec, flags);
}

I think GetAllFiles uses the same methods you are trying to use.

I don't know if that helps or not.

Regards,

Kevin

----- Original Message -----
From: "Otto Wyss" <w...@users.sourceforge.net>
Newsgroups: comp.soft-sys.wxwindows
To: <wx-u...@lists.wxwindows.org>

Aj Lavin

unread,
Dec 6, 2003, 8:40:51 PM12/6/03
to wx-u...@lists.wxwindows.org
Hello,

On Tue, Dec 02, 2003 at 10:13:00PM +0100, Otto Wyss wrote:


>
> "Kevin Hock" <hoc...@yahoo.com> wrote:
>
> > This code works fine for me:
> >
> > wxArrayString SkinFiles;
> > const wxString FileSpec = _T("*.zip");
> >

> This works here as well but how do you formulate multiple choices?
> VC++ accepts "*.cpp;*.h", explorer allows "*.cpp,*.h". At least
> "*.cpp|*.h" should work but it doesn't.


>
> > I think GetAllFiles uses the same methods you are trying to use.
> >
> > I don't know if that helps or not.

Yes, and they both end up in wxMatchWild under
wxGTK-2.4.2. wxMatchWild only supports '*' and '?', and does NOT
support multiple patterns like '|' or ';'.

On wxMSW-2.4.0 they end up calling the win32 function FindFirstFile,
"which can contain wildcard characters (* and ?)":

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/findfirstfile.asp

Looks like neither platform allows multiple patterns. I am guessing
that wxGTK's implementation was designed to emulate the behavior of
MSW's FindFirstFile.

- Aj

Fabian Cenedese

unread,
Dec 8, 2003, 4:54:39 AM12/8/03
to wx-u...@lists.wxwindows.org

>> This works here as well but how do you formulate multiple choices?
>> VC++ accepts "*.cpp;*.h", explorer allows "*.cpp,*.h". At least
>> "*.cpp|*.h" should work but it doesn't.
>
>Yes, and they both end up in wxMatchWild under
>wxGTK-2.4.2. wxMatchWild only supports '*' and '?', and does NOT
>support multiple patterns like '|' or ';'.
>
>On wxMSW-2.4.0 they end up calling the win32 function FindFirstFile,
>"which can contain wildcard characters (* and ?)":
>
>http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/findfirstfile.asp
>
>Looks like neither platform allows multiple patterns. I am guessing
>that wxGTK's implementation was designed to emulate the behavior of
>MSW's FindFirstFile.

The OpenFileDialogs under MSW do support multiple extensions, but
for FindFirstFile (don't know GTK) you'd need to split the string and loop
through all extensions.

bye Fabi

Reply all
Reply to author
Forward
0 new messages