MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / NFD_SaveDialogU8

Function NFD_SaveDialogU8

extern/nfd/nfd_win.cpp:864–899  ·  view source on GitHub ↗

save dialog */ It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function returns * NFD_OKAY */

Source from the content-addressed store, hash-verified

862/* It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function returns
863 * NFD_OKAY */
864nfdresult_t NFD_SaveDialogU8(nfdu8char_t** outPath,
865 const nfdu8filteritem_t* filterList,
866 nfdfiltersize_t count,
867 const nfdu8char_t* defaultPath,
868 const nfdu8char_t* defaultName) {
869 // populate the real nfdnfilteritem_t
870 FilterItem_Guard filterItemsNGuard;
871 if (!CopyFilterItem(filterList, count, filterItemsNGuard)) {
872 return NFD_ERROR;
873 }
874
875 // convert and normalize the default path, but only if it is not nullptr
876 FreeCheck_Guard<nfdnchar_t> defaultPathNGuard;
877 ConvertU8ToNative(defaultPath, defaultPathNGuard);
878 NormalizePathSeparator(defaultPathNGuard.data);
879
880 // convert the default name, but only if it is not nullptr
881 FreeCheck_Guard<nfdnchar_t> defaultNameNGuard;
882 ConvertU8ToNative(defaultName, defaultNameNGuard);
883
884 // call the native function
885 nfdnchar_t* outPathN;
886 nfdresult_t res = NFD_SaveDialogN(
887 &outPathN, filterItemsNGuard.data, count, defaultPathNGuard.data, defaultNameNGuard.data);
888
889 if (res != NFD_OKAY) {
890 return res;
891 }
892
893 // convert the outPath to UTF-8
894 res = CopyWCharToNFDChar(outPathN, *outPath);
895
896 // free the native out path, and return the result
897 NFD_FreePathN(outPathN);
898 return res;
899}
900
901/* select folder dialog */
902/* It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function returns

Callers 1

SaveDialogFunction · 0.85

Calls 6

CopyFilterItemFunction · 0.85
ConvertU8ToNativeFunction · 0.85
NormalizePathSeparatorFunction · 0.85
CopyWCharToNFDCharFunction · 0.85
NFD_SaveDialogNFunction · 0.70
NFD_FreePathNFunction · 0.70

Tested by

no test coverage detected