Load a lot of file name with wxFileDialog

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
lucafach
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Jul 27, 2017 4:33 pm

Load a lot of file name with wxFileDialog

Post by lucafach »

Hi,
I'm using wxWidget for a project that need to load and elaborate a lot of of small data files.
All works well until the number of files is about a thousand or little more (I don't know exactly), but when more files are selected (for example 2000 files) the wxStringArray returned by the wxFileDialog give a wrong path. My question is, is there any limitation about the number of file that can be selected with wxFileDialog or passed to wxStringArray? I didn't find such information into wxWidgets documentation. If so, how can I overcome such limitation ?
I attached a whole MSVS2010 test project here, compiled (DEBUG build) with wxWidgets 3.0.3 library and a folder with 2000 dummy text files.
The program generates an output file in the default temporary folder. I attached the output files for the good and fail case in the output subfolder.
Please, could you help me ?
Thank you very much.
PS. Unfortunately I was unable to load the executable file here (HTTP error).
Attachments
RemoteDataManager.zip
(9.28 KiB) Downloaded 51 times
Output.zip
(7.25 KiB) Downloaded 64 times
Data_Files.zip
(340.04 KiB) Downloaded 56 times
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Load a lot of file name with wxFileDialog

Post by doublemax »

I tested this and can confirm the issue. The problem is that wxWidgets passes a 64k buffer size to the native Windows filedialog. That's the maximum size for the complete paths of all selected files. So the maximum number of files you can select depends on the path the their filenames.

Unfortunately this limit is hardcoded into the wxWidgets sources. You can either modify the sources yourself and rebuild the wxWidgets libs and/or open a ticket at http://trac.wxwidgets.org

As a workaround, could you use wxDirDialog and let the user just select a directory and then you would process all files in that directory?
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7477
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Load a lot of file name with wxFileDialog

Post by ONEEYEMAN »

doublemax,
Maybe that was a limitation of the old Windows version and it not the case anymore?

Was there any comments in the sources?

Thank you.
lucafach
In need of some credit
In need of some credit
Posts: 2
Joined: Thu Jul 27, 2017 4:33 pm

Re: Load a lot of file name with wxFileDialog

Post by lucafach »

Thanks,

I could use wxDirDialog and I think this could be a good alternative.
Honestly, I'm not sure I can modify and successfully compile wxwidgets sources,
moreover I don't know a priori where the files are stored and how long the full path will be.

Do you know if there is a way to tell wxFileDialog to return just file name without the entire path ?
Post Reply