select folder dialog */ It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function returns * NFD_OKAY */
| 902 | /* It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function returns |
| 903 | * NFD_OKAY */ |
| 904 | nfdresult_t NFD_PickFolderU8(nfdu8char_t** outPath, const nfdu8char_t* defaultPath) { |
| 905 | // convert and normalize the default path, but only if it is not nullptr |
| 906 | FreeCheck_Guard<nfdnchar_t> defaultPathNGuard; |
| 907 | ConvertU8ToNative(defaultPath, defaultPathNGuard); |
| 908 | NormalizePathSeparator(defaultPathNGuard.data); |
| 909 | |
| 910 | // call the native function |
| 911 | nfdnchar_t* outPathN; |
| 912 | nfdresult_t res = NFD_PickFolderN(&outPathN, defaultPathNGuard.data); |
| 913 | |
| 914 | if (res != NFD_OKAY) { |
| 915 | return res; |
| 916 | } |
| 917 | |
| 918 | // convert the outPath to UTF-8 |
| 919 | res = CopyWCharToNFDChar(outPathN, *outPath); |
| 920 | |
| 921 | // free the native out path, and return the result |
| 922 | NFD_FreePathN(outPathN); |
| 923 | return res; |
| 924 | } |
| 925 | |
| 926 | /* Get the UTF-8 path at offset index */ |
| 927 | /* It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function returns |
no test coverage detected