How btzy/nativefiledialog-extended works
Native File Dialog Extended is a portable C library that lets applications request native file and folder selection without adopting a larger GUI toolkit. The main workflow is: an application initializes NFD, supplies dialog options through its API, and receives a selected path or path set from the platform-native dialog; callers then free returned data and shut down. Platform backends implement the native interaction, while optional C++ and SDL/GLFW headers adapt the API for those consumers. Backend dispatch and the macOS implementation are not shown in the excerpts, so those links rely on the README’s platform-support description.
Main entry points: nfd.h C dialog API · nfd_gtk.cpp GTK dialogs · nfd_portal.cpp Portal dialogs · nfd_win.cpp Windows dialogs
Components 12
Public API
- C dialog API
src/include/nfd.h
Platform dialogs
- Windows dialogs
src/nfd_win.cpp - macOS dialogs
src/nfd_cocoa.m
Consumer adapters
- C++ wrapper
src/include/nfd.hpp - GLFW adapter
src/include/nfd_glfw3.h - SDL2 adapter
src/include/nfd_sdl2.h - SDL3 adapter
src/include/nfd_sdl3.h
Linux support
- GTK dialogs
src/nfd_gtk.cpp - Portal dialogs
src/nfd_portal.cpp - Linux shared support
src/nfd_linux_shared.hpp
Other components
- Application
- Native dialog services
Connections 15
- Application → C dialog API: requests dialogs
README.md - C dialog API → Windows dialogs: dispatches
src/nfd_win.cpp - C dialog API → macOS dialogs: dispatches
- C dialog API → GTK dialogs: dispatches
src/nfd_gtk.cpp - C dialog API → Portal dialogs: dispatches
src/nfd_portal.cpp - Windows dialogs → Native dialog services: opens native UI
- macOS dialogs → Native dialog services: opens native UI
- GTK dialogs → Native dialog services: opens native UI
- Portal dialogs → Native dialog services: opens native UI
- GTK dialogs → Linux shared support: uses helpers
src/nfd_gtk.cpp - Portal dialogs → Linux shared support: uses helpers
src/nfd_portal.cpp - C++ wrapper → C dialog API: wraps calls
src/include/nfd.hpp - GLFW adapter → C dialog API: sets window handles
src/include/nfd_glfw3.h - SDL2 adapter → C dialog API: sets window handles
src/include/nfd_sdl2.h - SDL3 adapter → C dialog API: sets window handles
src/include/nfd_sdl3.h