@@ -996,6 +996,52 @@ you can check the DemoApp who is using an override for the Boost::filesystem
996996
997997</blockquote ></details >
998998
999+ <details open ><summary ><h2 >Modify file infos during scan by a callback</h2 ></summary ><blockquote >
1000+
1001+ In some case, it can be unsefull to modify file infos during scan
1002+ so you can define your callback and attached it in the FileDialogConfig struct in the field userFileAttributes
1003+
1004+ the callback stamp is :
1005+ ``` cpp
1006+ bool (IGFD::FileInfos* vFileInfosPtr, IGFD::UserDatas vUserDatas)
1007+ ```
1008+ if the callback is returning false, the file is ignored, so not displayed by the dialog
1009+
1010+ example : with the gltf separated files : (see the branch DemoApp for example use)
1011+
1012+ A gltf file can have data description and datas files separated.
1013+ in this case only the file with description will be shown in the dialog, so with not the full size of all attached datas
1014+
1015+ with this function, you can compose the path of the bin file, get his size, sum it to the desciption file size and use it
1016+
1017+ syntax :
1018+ ``` cpp
1019+ config.userFileAttributes = [](IGFD::FileInfos* vFileInfosPtr, IGFD::UserDatas vUserDatas) -> bool {
1020+ if (vFileInfosPtr != nullptr) {
1021+ // this demo not take into account .gltf who have data insise. besauce keepd easy just for demo
1022+ if (vFileInfosPtr->SearchForExt(".gltf", true)) {
1023+ auto bin_file_path_name = vFileInfosPtr->filePath + IGFD::Utils::GetPathSeparator() + vFileInfosPtr->fileNameLevels[0] + ".bin";
1024+ struct stat statInfos = {};
1025+ char timebuf[100];
1026+ int result = stat(bin_file_path_name.c_str(), &statInfos);
1027+ if (!result) {
1028+ vFileInfosPtr->fileSize += (size_t)statInfos.st_size; // add the size of bin file to the size of the gltf file
1029+ } else {
1030+ // no bin, so escaped.
1031+ // normally we must parse the file and check the uri for get the buffer file
1032+ // but here we keep the example as easy for demo.
1033+ return false;
1034+ }
1035+ }
1036+ }
1037+ return true;
1038+ };
1039+ ```
1040+
1041+ ![ user_file_attributes.gif] ( https://github.com/aiekick/ImGuiFileDialog/blob/DemoApp/doc/user_file_attributes.png )
1042+
1043+ </blockquote ></details >
1044+
9991045<details open ><summary ><h2 >C Api :</h2 ></summary ><blockquote >
10001046
10011047this api was sucessfully tested with CImGui
0 commit comments