I have noticed that OpenDialog can only return a limited number of files in Windows, in Mac there seems to be no limit and I may select thousand files easily.
It seems to be related to the length of the file names, and probably full path, but for a name like “001 Large file name.jpg” it is around 300 files. Tested with Xojo 2015 2.4 and Windows 10 64bits.
Once you select more files the returned folderitem is no longer an array, the path is only partial and dlg.count is 1.
Am I missing something or is this a bug?
Don’t take this as a expert opinion but I think it may be something else, like you’re filtering something you don’t know or there’s corruption or permission funniness, or over MAX_PATH on what you tested.
OpenDialog is a wrapper into the standard common dialog set and Xojo doesn’t pay strict attention to what it shows. In other words, it’s how you’re playing with Windows more than how you’re playing with Xojo.
Thanks for your answer Garth, I have checked that there is no filter, corruption or permissions and as far as I know MAX_PATH is only applied to the length of one path and not the number of paths.
If I drag the files from Windows File Explorer they are handled correctly and it seems to be no limit, it’s only when I open the system dialog to get the same files.
I have tried from different folders and with different files, I believe there is a limit on the sum of all characters returned to Xojo by the OS dialog.
Code is just as follows, in a new application with no other code besides from a button to call this
Dim dlg As New OpenDialog
dim f as FolderItem = dlg.ShowModal()
if f <> nil then
f is returned as a single path string but shortened several characters and Count is only 1.
To clarify: the number of files shown in the dialog is correct, the problem is on the number of items returned to Xojo after clicking on the action button.
I’m not sure if f is guaranteed to return, so your code test isn’t perfectly accurate, but since it is returning, perhaps .Count is wrong, but did you check Item() where the files are supposed to be?
So you mean that when setting MultiSelect, and you multiselect in the dialog more than 300 files, .Count is always 1 *even for less than 300?) but you can scan Item() and it’ll give you everything that way but .Name gives you truncated names? Are they the ShortNames 8.3 with the tildes?
I don’t use Xojo new so I can’t check for you, but it does sound like a bug, a pretty big one at that. Anyone else?
Yes, I’m using items for the returned items, but if I try to get any item it raises an outofbounds exception. As summary:
By selecting a high number of files for an OpenDialog in Windows with MultiSelect enabled it returns
- a truncated path in folderitem, usually converting the last characters in …\Debugtest_alt\? or similar (being test_alt my app). I don’t think this are the 8.3 shortnames.
- dlg.count is always 1
- dlg.items(0) returns the same as folderitem (truncated path)
- dlg.items(1) and higher raises OutofBounds exception
- the number of files to select for getting this issue depends on the length of the path and file names used, a longer string requires less files to be selected ( for files like D:\Temp\Test dialog\001 Large file name.jpg it takes around 300)
As additional info: using OpenDialogMBS works fine with the same folder and files returning correct values. Dropping the files from File explorer works also fine.
No problems in Mac that I know, the issue is only in Windows.
Please file a bug report.
Done, case is:
41602 - OpenDialog file limit in Windows