michaelbartnett / nfd-zig

OS-native file dialogs on Linux, macOS and Windows

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nfd-zig

nfd-zig is a Zig binding to the library nativefiledialog which provides a convenient cross-platform interface to opening file dialogs on Linux, macOS and Windows.

This library has been tested on Windows 10, macOS 11.1 and Linux.

Usage

You can run a demo with zig build run. The demo's source is in src/demo.zig.

If you want to add the library to your own project...

  • Add the nfd package to your executable in your build.zig
    const nfd_build = @import("deps/nfd-zig/build.zig");
    exe.addPackage(nfd_build.getPackage("nfd"));
  • Because nativefiledialog is a C library you have to link it to your executable
    const nfd_build = @import("deps/nfd-zig/build.zig");
    const nfd_lib = nfd_build.makeLib(b, mode, target);
    exe.linkLibrary(nfd_lib);

Screenshot

Open dialog on Windows 10

About

OS-native file dialogs on Linux, macOS and Windows

License:MIT License


Languages

Language:Zig 100.0%