adding a null backend for nfd

This commit is contained in:
peterino2 2025-06-07 14:35:18 -07:00
parent d90d9276b2
commit b89dcfd9e4
2 changed files with 52 additions and 6 deletions

16
lib/nfd/build.zig vendored
View File

@ -31,15 +31,19 @@ pub fn build(b: *std.Build) void {
}); });
mod.linkSystemLibrary("ole32", .{}); mod.linkSystemLibrary("ole32", .{});
} else if (target.result.os.tag == .linux) { } else if (target.result.os.tag == .linux) {
// mod.addCSourceFile(.{
// .file = b.path("src/nfd_gtk.c"),
// .flags = &.{},
// });
mod.addCSourceFile(.{ mod.addCSourceFile(.{
.file = b.path("src/nfd_gtk.c"), .file = b.path("src/nfd_null.c"),
.flags = &.{}, .flags = &.{},
}); });
mod.linkSystemLibrary("gdk-3", .{}); // mod.linkSystemLibrary("gdk-3", .{});
mod.linkSystemLibrary("atk-1.0", .{}); // mod.linkSystemLibrary("atk-1.0", .{});
mod.linkSystemLibrary("gtk-3", .{}); // mod.linkSystemLibrary("gtk-3", .{});
mod.linkSystemLibrary("glib-2.0", .{}); // mod.linkSystemLibrary("glib-2.0", .{});
mod.linkSystemLibrary("gobject-2.0", .{}); // mod.linkSystemLibrary("gobject-2.0", .{});
} }
const p2dep = b.dependency("p2", .{ .target = target, .optimize = optimize }); const p2dep = b.dependency("p2", .{ .target = target, .optimize = optimize });

42
lib/nfd/src/nfd_null.c vendored Normal file
View File

@ -0,0 +1,42 @@
/*
Native File Dialog
http://www.frogtoss.com/labs
*/
#include <stdio.h>
#include <assert.h>
#include <string.h>
#include "nfd.h"
#include "nfd_common.h"
const char INIT_FAIL_MSG[] = "gtk_init_check failed to initilaize GTK+";
nfdresult_t NFD_OpenDialog( const nfdchar_t *filterList,
const nfdchar_t *defaultPath,
nfdchar_t **outPath )
{
return NFD_CANCEL;
}
nfdresult_t NFD_OpenDialogMultiple( const nfdchar_t *filterList,
const nfdchar_t *defaultPath,
nfdpathset_t *outPaths )
{
return NFD_CANCEL;
}
nfdresult_t NFD_SaveDialog( const nfdchar_t *filterList,
const nfdchar_t *defaultPath,
nfdchar_t **outPath )
{
return NFD_CANCEL;
}
nfdresult_t NFD_PickFolder(const nfdchar_t *defaultPath,
nfdchar_t **outPath)
{
return NFD_CANCEL;
}