cross platform native open/save file dialogs

Ponkadoodle picture Ponkadoodle · May 27, 2011 · Viewed 13.2k times · Source

I'm writing a UI for my program using opengl with SDL in a combination of Lua and C++

What I need now is some library that will allow me to call a function that presents the user with a file select dialog for opening/saving a file. But if the OS offers native functionality for such a dialog, then I want to use that dialog (eg Window's GetOpenFileName).

The only platforms I need to support are Windows and Linux, but I want to be able to still use most of the SDL & openGL code I've already written.

What options are available?

Answer

Michael Labbé picture Michael Labbé · Dec 4, 2014

You should take a good look at Native File Dialog. It is a small, portable C library that lets you use load and save dialogs in a cross platform manner without linking huge dependencies like qt or wxWidgets.

I am the author, and I use it with SDL2 and OpenGL on Linux, Mac and Windows.

https://github.com/mlabbe/nativefiledialog