2929
3030#ifdef __cplusplus
3131extern "C" {
32+ #define NFD_INLINE inline
33+ #else
34+ #define NFD_INLINE static inline
3235#endif // __cplusplus
3336
3437#include <stddef.h>
@@ -93,6 +96,59 @@ typedef struct {
9396typedef nfdu8filteritem_t nfdnfilteritem_t ;
9497#endif // _WIN32
9598
99+ typedef size_t nfdversion_t ;
100+
101+ typedef struct {
102+ const nfdu8filteritem_t * filterList ;
103+ nfdfiltersize_t filterCount ;
104+ const nfdu8char_t * defaultPath ;
105+ } nfdopendialogu8args_t ;
106+
107+ #ifdef _WIN32
108+ typedef struct {
109+ const nfdnfilteritem_t * filterList ;
110+ nfdfiltersize_t filterCount ;
111+ const nfdnchar_t * defaultPath ;
112+ } nfdopendialognargs_t ;
113+ #else
114+ typedef nfdopendialogu8args_t nfdopendialognargs_t ;
115+ #endif // _WIN32
116+
117+ typedef struct {
118+ const nfdu8filteritem_t * filterList ;
119+ nfdfiltersize_t filterCount ;
120+ const nfdu8char_t * defaultPath ;
121+ const nfdu8char_t * defaultName ;
122+ } nfdsavedialogu8args_t ;
123+
124+ #ifdef _WIN32
125+ typedef struct {
126+ const nfdnfilteritem_t * filterList ;
127+ nfdfiltersize_t filterCount ;
128+ const nfdnchar_t * defaultPath ;
129+ const nfdnchar_t * defaultName ;
130+ } nfdsavedialognargs_t ;
131+ #else
132+ typedef nfdsavedialogu8args_t nfdsavedialognargs_t ;
133+ #endif // _WIN32
134+
135+ typedef struct {
136+ const nfdu8char_t * defaultPath ;
137+ } nfdpickfolderu8args_t ;
138+
139+ #ifdef _WIN32
140+ typedef struct {
141+ const nfdnchar_t * defaultPath ;
142+ } nfdpickfoldernargs_t ;
143+ #else
144+ typedef nfdpickfolderu8args_t nfdpickfoldernargs_t ;
145+ #endif // _WIN32
146+
147+ // This is a unique identifier tagged to all the NFD_*With() function calls, for backward
148+ // compatibility purposes. There is usually no need to use this directly, unless you want to use
149+ // NFD differently depending on the version you're building with.
150+ #define NFD_INTERFACE_VERSION 1
151+
96152/** Free a file path that was returned by the dialogs.
97153 *
98154 * Note: use NFD_PathSet_FreePathN() to free path from pathset instead of this function. */
@@ -134,6 +190,35 @@ NFD_API nfdresult_t NFD_OpenDialogU8(nfdu8char_t** outPath,
134190 nfdfiltersize_t filterCount ,
135191 const nfdu8char_t * defaultPath );
136192
193+ /** This function is a library implementation detail. Please use NFD_OpenDialogN_With() instead. */
194+ NFD_API nfdresult_t NFD_OpenDialogN_With_Impl (nfdversion_t version ,
195+ nfdnchar_t * * outPath ,
196+ const nfdopendialognargs_t * args );
197+
198+ /** Single file open dialog, with additional parameters.
199+ *
200+ * It is the caller's responsibility to free `outPath` via NFD_FreePathN() if this function
201+ * returns NFD_OKAY. See documentation of nfdopendialognargs_t for details. */
202+ NFD_INLINE nfdresult_t NFD_OpenDialogN_With (nfdnchar_t * * outPath ,
203+ const nfdopendialognargs_t * args ) {
204+ return NFD_OpenDialogN_With_Impl (NFD_INTERFACE_VERSION , outPath , args );
205+ }
206+
207+ /** This function is a library implementation detail. Please use NFD_OpenDialogU8_With() instead.
208+ */
209+ NFD_API nfdresult_t NFD_OpenDialogU8_With_Impl (nfdversion_t version ,
210+ nfdu8char_t * * outPath ,
211+ const nfdopendialogu8args_t * args );
212+
213+ /** Single file open dialog, with additional parameters.
214+ *
215+ * It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function
216+ * returns NFD_OKAY. See documentation of nfdopendialogu8args_t for details. */
217+ NFD_INLINE nfdresult_t NFD_OpenDialogU8_With (nfdu8char_t * * outPath ,
218+ const nfdopendialogu8args_t * args ) {
219+ return NFD_OpenDialogU8_With_Impl (NFD_INTERFACE_VERSION , outPath , args );
220+ }
221+
137222/** Multiple file open dialog
138223 *
139224 * It is the caller's responsibility to free `outPaths` via NFD_PathSet_FreeN() if this function
@@ -158,6 +243,36 @@ NFD_API nfdresult_t NFD_OpenDialogMultipleU8(const nfdpathset_t** outPaths,
158243 nfdfiltersize_t filterCount ,
159244 const nfdu8char_t * defaultPath );
160245
246+ /** This function is a library implementation detail. Please use NFD_OpenDialogMultipleN_With()
247+ * instead. */
248+ NFD_API nfdresult_t NFD_OpenDialogMultipleN_With_Impl (nfdversion_t version ,
249+ const nfdpathset_t * * outPaths ,
250+ const nfdopendialognargs_t * args );
251+
252+ /** Multiple file open dialog, with additional parameters.
253+ *
254+ * It is the caller's responsibility to free `outPaths` via NFD_PathSet_FreeN() if this function
255+ * returns NFD_OKAY. See documentation of nfdopendialognargs_t for details. */
256+ NFD_INLINE nfdresult_t NFD_OpenDialogMultipleN_With (const nfdpathset_t * * outPaths ,
257+ const nfdopendialognargs_t * args ) {
258+ return NFD_OpenDialogMultipleN_With_Impl (NFD_INTERFACE_VERSION , outPaths , args );
259+ }
260+
261+ /** This function is a library implementation detail. Please use NFD_OpenDialogU8_With() instead.
262+ */
263+ NFD_API nfdresult_t NFD_OpenDialogMultipleU8_With_Impl (nfdversion_t version ,
264+ const nfdpathset_t * * outPaths ,
265+ const nfdopendialogu8args_t * args );
266+
267+ /** Multiple file open dialog, with additional parameters.
268+ *
269+ * It is the caller's responsibility to free `outPaths` via NFD_PathSet_FreeU8() if this function
270+ * returns NFD_OKAY. See documentation of nfdopendialogu8args_t for details. */
271+ NFD_INLINE nfdresult_t NFD_OpenDialogMultipleU8_With (const nfdpathset_t * * outPaths ,
272+ const nfdopendialogu8args_t * args ) {
273+ return NFD_OpenDialogMultipleU8_With_Impl (NFD_INTERFACE_VERSION , outPaths , args );
274+ }
275+
161276/** Save dialog
162277 *
163278 * It is the caller's responsibility to free `outPath` via NFD_FreePathN() if this function returns
@@ -184,22 +299,80 @@ NFD_API nfdresult_t NFD_SaveDialogU8(nfdu8char_t** outPath,
184299 const nfdu8char_t * defaultPath ,
185300 const nfdu8char_t * defaultName );
186301
187- /** Select folder dialog
302+ /** This function is a library implementation detail. Please use NFD_SaveDialogN_With() instead. */
303+ NFD_API nfdresult_t NFD_SaveDialogN_With_Impl (nfdversion_t version ,
304+ nfdnchar_t * * outPath ,
305+ const nfdsavedialognargs_t * args );
306+
307+ /** Single file save dialog, with additional parameters.
308+ *
309+ * It is the caller's responsibility to free `outPath` via NFD_FreePathN() if this function
310+ * returns NFD_OKAY. See documentation of nfdsavedialognargs_t for details. */
311+ NFD_INLINE nfdresult_t NFD_SaveDialogN_With (nfdnchar_t * * outPath ,
312+ const nfdsavedialognargs_t * args ) {
313+ return NFD_SaveDialogN_With_Impl (NFD_INTERFACE_VERSION , outPath , args );
314+ }
315+
316+ /** This function is a library implementation detail. Please use NFD_SaveDialogU8_With() instead.
317+ */
318+ NFD_API nfdresult_t NFD_SaveDialogU8_With_Impl (nfdversion_t version ,
319+ nfdu8char_t * * outPath ,
320+ const nfdsavedialogu8args_t * args );
321+
322+ /** Single file save dialog, with additional parameters.
323+ *
324+ * It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function
325+ * returns NFD_OKAY. See documentation of nfdsavedialogu8args_t for details. */
326+ NFD_INLINE nfdresult_t NFD_SaveDialogU8_With (nfdu8char_t * * outPath ,
327+ const nfdsavedialogu8args_t * args ) {
328+ return NFD_SaveDialogU8_With_Impl (NFD_INTERFACE_VERSION , outPath , args );
329+ }
330+
331+ /** Select single folder dialog
188332 *
189333 * It is the caller's responsibility to free `outPath` via NFD_FreePathN() if this function returns
190334 * NFD_OKAY.
191335 * @param[out] outPath
192336 * @param defaultPath If null, the operating system will decide. */
193337NFD_API nfdresult_t NFD_PickFolderN (nfdnchar_t * * outPath , const nfdnchar_t * defaultPath );
194338
195- /** Select folder dialog
339+ /** Select single folder dialog
196340 *
197341 * It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function
198342 * returns NFD_OKAY.
199343 * @param[out] outPath
200344 * @param defaultPath If null, the operating system will decide. */
201345NFD_API nfdresult_t NFD_PickFolderU8 (nfdu8char_t * * outPath , const nfdu8char_t * defaultPath );
202346
347+ /** This function is a library implementation detail. Please use NFD_PickFolderN_With() instead. */
348+ NFD_API nfdresult_t NFD_PickFolderN_With_Impl (nfdversion_t version ,
349+ nfdnchar_t * * outPath ,
350+ const nfdpickfoldernargs_t * args );
351+
352+ /** Select single folder dialog, with additional parameters.
353+ *
354+ * It is the caller's responsibility to free `outPath` via NFD_FreePathN() if this function
355+ * returns NFD_OKAY. See documentation of nfdpickfoldernargs_t for details. */
356+ NFD_INLINE nfdresult_t NFD_PickFolderN_With (nfdnchar_t * * outPath ,
357+ const nfdpickfoldernargs_t * args ) {
358+ return NFD_PickFolderN_With_Impl (NFD_INTERFACE_VERSION , outPath , args );
359+ }
360+
361+ /** This function is a library implementation detail. Please use NFD_PickFolderU8_With() instead.
362+ */
363+ NFD_API nfdresult_t NFD_PickFolderU8_With_Impl (nfdversion_t version ,
364+ nfdu8char_t * * outPath ,
365+ const nfdpickfolderu8args_t * args );
366+
367+ /** Select single folder dialog, with additional parameters.
368+ *
369+ * It is the caller's responsibility to free `outPath` via NFD_FreePathU8() if this function
370+ * returns NFD_OKAY. See documentation of nfdpickfolderu8args_t for details. */
371+ NFD_INLINE nfdresult_t NFD_PickFolderU8_With (nfdu8char_t * * outPath ,
372+ const nfdpickfolderu8args_t * args ) {
373+ return NFD_PickFolderU8_With_Impl (NFD_INTERFACE_VERSION , outPath , args );
374+ }
375+
203376/** Get the last error
204377 *
205378 * This is set when a function returns NFD_ERROR.
@@ -308,6 +481,7 @@ typedef nfdu8filteritem_t nfdfilteritem_t;
308481#define NFD_PathSet_EnumNext NFD_PathSet_EnumNextU8
309482#endif // NFD_NATIVE
310483
484+ #undef NFD_INLINE
311485#ifdef __cplusplus
312486}
313487#endif // __cplusplus
0 commit comments