| 805 | } |
| 806 | |
| 807 | nfdresult_t NFD_OpenDialogU8(nfdu8char_t** outPath, |
| 808 | const nfdu8filteritem_t* filterList, |
| 809 | nfdfiltersize_t count, |
| 810 | const nfdu8char_t* defaultPath) { |
| 811 | // populate the real nfdnfilteritem_t |
| 812 | FilterItem_Guard filterItemsNGuard; |
| 813 | if (!CopyFilterItem(filterList, count, filterItemsNGuard)) { |
| 814 | return NFD_ERROR; |
| 815 | } |
| 816 | |
| 817 | // convert and normalize the default path, but only if it is not nullptr |
| 818 | FreeCheck_Guard<nfdnchar_t> defaultPathNGuard; |
| 819 | ConvertU8ToNative(defaultPath, defaultPathNGuard); |
| 820 | NormalizePathSeparator(defaultPathNGuard.data); |
| 821 | |
| 822 | // call the native function |
| 823 | nfdnchar_t* outPathN; |
| 824 | nfdresult_t res = |
| 825 | NFD_OpenDialogN(&outPathN, filterItemsNGuard.data, count, defaultPathNGuard.data); |
| 826 | |
| 827 | if (res != NFD_OKAY) { |
| 828 | return res; |
| 829 | } |
| 830 | |
| 831 | // convert the outPath to UTF-8 |
| 832 | res = CopyWCharToNFDChar(outPathN, *outPath); |
| 833 | |
| 834 | // free the native out path, and return the result |
| 835 | NFD_FreePathN(outPathN); |
| 836 | return res; |
| 837 | } |
| 838 | |
| 839 | /* multiple file open dialog */ |
| 840 | /* It is the caller's responsibility to free `outPaths` via NFD_PathSet_Free() if this function |
no test coverage detected