3.2.3 The tinyfd_openFileDialog returns null upon file selection (both single and multiple) if the selected file(s) size is larger than 2GB. In case of multi-file selection only the files smaller than ~2GB will be included in the results. Can anyone else confirm if this is happening? I'm running Windows 10 64bit 20H2 fully patched.
I can reproduce this. Looks like tinyfd uses fopen to verify that the selected files are valid, which fails on 2GB+ files.
Thanks for looking into it, have you by any chance checked if they have become aware of the issue and already fixed it in their more recent versions?
Yes, the latest version still uses fopen.
Btw, you could try switching to Native File Dialog, its file open dialog doesn't have this issue.
Found the issue, fclose is actually not even involved with the check since by default the build is UTF8 now. He uses stat.h to retrieve data with _wstat into an instance of _stat. Tried replacing both the struct and the function call to their _stat64 and _wstat64 variants and it worked without an issue. I guess I'll drop the author a message and see if such change makes sense moving forward and does not break compatibility with some old versions of windows.
static int fileExists(char const * aFilePathAndName)
{
struct _stat lInfo;
wchar_t * lTmpWChar;
int lStatRet;
FILE * lIn;
if (!aFilePathAndName || !strlen(aFilePathAndName))
{
return 0;
}
if (tinyfd_winUtf8)
{
lTmpWChar = tinyfd_utf8to16(aFilePathAndName);
lStatRet = _wstat(lTmpWChar, &lInfo);
if (lStatRet != 0)
return 0;
else if (lInfo.st_mode & _S_IFREG)
return 1;
else
return 0;
}
else
{
lIn = fopen(aFilePathAndName, "r");
if (!lIn)
{
return 0;
}
fclose(lIn);
return 1;
}
}
I contacted Guillaume Vareille, the author of tinyfd, and he was able to deploy a fix (which I tested and is working) in the latest version (3.8.7), I'll be waiting for LWJGL 3.2.4, luckily I'm not in a rush to have support for very large files right now.
I'm not sure how much the APIs have changed since the version currently in the master branch, but he told me he hasn't changed the APIs in a long time.
Most helpful comment
I contacted Guillaume Vareille, the author of tinyfd, and he was able to deploy a fix (which I tested and is working) in the latest version (3.8.7), I'll be waiting for LWJGL 3.2.4, luckily I'm not in a rush to have support for very large files right now.
I'm not sure how much the APIs have changed since the version currently in the master branch, but he told me he hasn't changed the APIs in a long time.