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

Function NFD_OpenDialogU8

extern/nfd/nfd_win.cpp:807–837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

805}
806
807nfdresult_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

Callers 1

OpenDialogFunction · 0.85

Calls 6

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

Tested by

no test coverage detected