Skip to content

A tiny, neat C library that portably invokes native file open and save dialogs.

License

Notifications You must be signed in to change notification settings

Vita3K/nativefiledialog-cmake

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Native File Dialog CMake

In this fork I replaced Premake and other build system with CMake

For more information look at the original README.md

Example

An example of CMakeLists.txt

add_subdirectory(libs/nativefiledialog)
add_executable(mytarget main.cpp)
target_link_libraries(mytarget nativefiledialog)

and main.cpp

#include <nfd.h>
#include <stdio.h>
#include <stdlib.h>

int main( void )
{
    nfdchar_t *outPath = NULL;
    nfdresult_t result = NFD_OpenDialog( NULL, NULL, &outPath );
        
    if ( result == NFD_OKAY ) {
        puts("Success!");
        puts(outPath);
        free(outPath);
    }
    else if ( result == NFD_CANCEL ) {
        puts("User pressed cancel.");
    }
    else {
        printf("Error: %s\n", NFD_GetError() );
    }

    return 0;
}

See NFD.h for more options.

Screenshots

Windows 8 rendering an IFileOpenDialog GTK3 on Linux Cocoa on Yosemite

Changelog

release what's new date
1.0.0 initial oct 2014
1.1.0 premake5; scons deprecated aug 2016
1.1.1 mingw support, build fixes aug 2016
1.1.2 test_pickfolder() added aug 2016
1.1.3 zenity linux backend added nov 2017
1.1.3 fix char type in decls nov 2017
1.1.4 fix win32 memleaks dec 2018
1.1.4 improve win32 errorhandling dec 2018
1.1.4 macos fix focus bug dec 2018

About

A tiny, neat C library that portably invokes native file open and save dialogs.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 49.7%
  • C++ 37.3%
  • Objective-C 11.8%
  • CMake 1.2%