Is wxDir broken? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
I live to help wx-kind
I live to help wx-kind
Posts: 195
Joined: Wed Sep 28, 2005 9:42 pm

Is wxDir broken?

Post by cpp » Wed Feb 22, 2006 10:26 pm

take this code:

Code: Select all

// this directory DOES exsists, and it DOES have 4 .xml files in it
wxString myDir(wxT("C:\\somedir"); 
wxArrayString theFiles;
wxDir::GetAllFiles(myDir, &theFiles, wxT("xml"), wxDIR_FILES);
// check that wxDir found the files
wxASSERT(theFiles.GetCount()>0); // this fails ALLWAYS 
Yep, it NEVER finds any files, ibe tried replacing wxT("xml") to wxT(".xml"), no luck. The only way it works, is if i leave the file extension empty, but (of course) its NOT what i want, since it enums all files of all types.
im i doing something wrong, or is wxDir broken?

Hier Kommt die Sonne...

I live to help wx-kind
I live to help wx-kind
Posts: 199
Joined: Mon Nov 21, 2005 4:34 pm

Post by Ksmith22 » Wed Feb 22, 2006 10:28 pm


Code: Select all

wxDir::GetAllFiles(myDir, &theFiles, wxT("*.xml"), wxDIR_FILES);
The file extension needs to have the '*.' in front of it I think.

The & might not be required in front of 'theFiles' either, but I pass an actual pointer in my call so maybe it is for your case.

Post Reply