Skip to content

Commit

Permalink
fix api changes of zig nightly
Browse files Browse the repository at this point in the history
nothing
  • Loading branch information
jinzhongjia committed Mar 23, 2024
1 parent e048b21 commit c83a13f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
.minimum_zig_version = "0.11.0",
.dependencies = .{
.webui = .{
.url = "https://github.com/webui-dev/webui/archive/c56260ff0de8f13a49559ca592009093a5279e25.tar.gz",
.hash = "1220b7199d576b0aa86449975518dfd7c694c12ea348b8c13223332e265216497c3b",
.url = "https://github.com/webui-dev/webui/archive/e108e4b231fc6c3c431091638718b18aac8a78d6.tar.gz",
.hash = "1220607529b67bcdc63413b3ad6af6d9bb7c907304417ff6d6acecce197a78d4ec82",
},
},
.paths = .{
Expand Down
14 changes: 7 additions & 7 deletions build_12.zig
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub fn build_12(b: *Build) void {
log.info("enable TLS support", .{});
if (!target.query.isNative()) {
log.info("when enable tls, not support cross compile", .{});
std.os.exit(1);
std.posix.exit(1);
}
}

Expand Down Expand Up @@ -109,7 +109,7 @@ fn build_examples_12(b: *Build, optimize: OptimizeMode, target: Build.ResolvedTa
var iter_dir =
std.fs.openDirAbsolute(examples_path, .{ .iterate = true }) catch |err| {
log.err("open examples_path failed, err is {}", .{err});
std.os.exit(1);
std.posix.exit(1);
};
defer iter_dir.close();

Expand All @@ -121,7 +121,7 @@ fn build_examples_12(b: *Build, optimize: OptimizeMode, target: Build.ResolvedTa
const example_name = entry.name;
const path = std.fmt.allocPrint(b.allocator, "src/examples/{s}/main.zig", .{example_name}) catch |err| {
log.err("fmt path for examples failed, err is {}", .{err});
std.os.exit(1);
std.posix.exit(1);
};

const exe = b.addExecutable(.{
Expand All @@ -143,20 +143,20 @@ fn build_examples_12(b: *Build, optimize: OptimizeMode, target: Build.ResolvedTa

const cwd = std.fmt.allocPrint(b.allocator, "src/examples/{s}", .{example_name}) catch |err| {
log.err("fmt path for examples failed, err is {}", .{err});
std.os.exit(1);
std.posix.exit(1);
};
exe_run.setCwd(.{
.path = cwd,
});

const step_name = std.fmt.allocPrint(b.allocator, "run_{s}", .{example_name}) catch |err| {
log.err("fmt step_name for examples failed, err is {}", .{err});
std.os.exit(1);
std.posix.exit(1);
};

const step_desc = std.fmt.allocPrint(b.allocator, "run_{s}", .{example_name}) catch |err| {
log.err("fmt step_desc for examples failed, err is {}", .{err});
std.os.exit(1);
std.posix.exit(1);
};

const exe_run_step = b.step(step_name, step_desc);
Expand All @@ -167,6 +167,6 @@ fn build_examples_12(b: *Build, optimize: OptimizeMode, target: Build.ResolvedTa
}
} else |err| {
log.err("iterate examples_path failed, err is {}", .{err});
std.os.exit(1);
std.posix.exit(1);
}
}
7 changes: 6 additions & 1 deletion src/webui.zig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
//! Licensed under MIT License.

const std = @import("std");
const builtin = @import("builtin");
const flags = @import("flags");

const WebUI = @cImport({
Expand Down Expand Up @@ -208,7 +209,11 @@ pub fn newWindow() Self {
pub fn newWindowWithId(id: usize) Self {
if (id == 0 or id >= WebUI.WEBUI_MAX_IDS) {
std.log.err("id {} is illegal", .{id});
std.os.exit(1);
if (comptime builtin.zig_version.minor == 11) {
std.os.exit(1);
} else if (comptime builtin.zig_version.minor == 12) {
std.posix.exit(1);
}
}
return .{
.window_handle = WebUI.webui_new_window_id(id),
Expand Down

0 comments on commit c83a13f

Please sign in to comment.