https://github.com/fabioarnold/nfd-zig
OS-native file dialogs on Linux, macOS and Windows
https://github.com/fabioarnold/nfd-zig
file-dialog native zig zig-package
Last synced: 2 months ago
JSON representation
OS-native file dialogs on Linux, macOS and Windows
- Host: GitHub
- URL: https://github.com/fabioarnold/nfd-zig
- Owner: fabioarnold
- License: mit
- Created: 2020-12-27T19:12:22.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2025-08-26T07:47:42.000Z (10 months ago)
- Last Synced: 2026-04-06T14:50:33.393Z (2 months ago)
- Topics: file-dialog, native, zig, zig-package
- Language: Makefile
- Homepage:
- Size: 182 KB
- Stars: 63
- Watchers: 1
- Forks: 17
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-zig - nfd-zig🗒️OS-native file dialogs on Linux, macOS and Windows
README
# nfd-zig
`nfd-zig` is a Zig binding to the library [nativefiledialog](https://github.com/mlabbe/nativefiledialog)
which provides a convenient cross-platform interface to opening file dialogs in
Linux, macOS and Windows.
This library has been tested on Windows 10, macOS 11.1 and Linux.
## Usage
You can run the 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:
- Fetch the `nfd` dependency:
```bash
zig fetch --save git+https://github.com/fabioarnold/nfd-zig.git
```
This will add the `nfd` dependency to your `build.zig.zon`. e.g.,
```zig
.nfd = .{
.url = "git+https://github.com/fabioarnold/nfd-zig.git#0ad2a0c092ffba0c98613d619b82100c991f5ad6",
.hash = "nfd-0.1.0-11fxvN6IBgD5rvvfjrw1wPqibMsbUJ-h2ZcGR6FOEvrm",
},
```
- Add the module in your `build.zig`:
```zig
const nfd = b.dependency("nfd", .{ .target = target, .optimize = optimize });
const nfd_mod = nfd.module("nfd");
exe.root_module.addImport("nfd", nfd_mod);
```
- Import and use it your code, e.g., `main.zig`:
```zig
const nfd = @import("nfd");
pub fn main() !void {
const filter = "txt";
const default_path: ?[]const u8 = null;
const path: ?[]const u8 = try nfd.openFileDialog(filter, default_path);
}
```
## Screenshot


