authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-29 16:35:00 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2026-05-29 16:35:00 -07:00
log18b00c5c5d25e230ff4f3ea07fadb2a1d54a773d
tree35cedd92bc61d27215ff0a1b52ad653d3af51040
parentcd5a750bf6d58fa355efe2223c3f9c0626198f13
signaturebadge-check Signed by SSH key SHA256:4hHJbtBRU58AYXwjL7fkz2fnQHdiye8x1QpTCQ0sHNw

macos support


5 files changed, 17 insertions(+), 3 deletions(-)

Dir.zig+1
...@@ -9,6 +9,7 @@ const os = builtin.target.os.tag;...@@ -9,6 +9,7 @@ const os = builtin.target.os.tag;
99
10const sys = switch (os) {10const sys = switch (os) {
11 .linux => @import("sys-linux"),11 .linux => @import("sys-linux"),
12 .macos => @import("sys-darwin"),
12 else => unreachable,13 else => unreachable,
13};14};
1415
File.zig+11
...@@ -11,6 +11,7 @@ const os = builtin.target.os.tag;...@@ -11,6 +11,7 @@ const os = builtin.target.os.tag;
1111
12const sys = switch (os) {12const sys = switch (os) {
13 .linux => @import("sys-linux"),13 .linux => @import("sys-linux"),
14 .macos => @import("sys-darwin"),
14 else => unreachable,15 else => unreachable,
15};16};
1617
...@@ -151,6 +152,16 @@ pub const Stat = struct {...@@ -151,6 +152,16 @@ pub const Stat = struct {
151 .ctime = @as(i128, st.ctim.sec) * time.ns_per_s + st.ctim.nsec,152 .ctime = @as(i128, st.ctim.sec) * time.ns_per_s + st.ctim.nsec,
152 };153 };
153 }154 }
155 if (os == .macos) {
156 return .{
157 .inode = st.ino,
158 .size = @bitCast(st.size),
159 .mode = st.mode,
160 .atime = @as(i128, st.atimespec.sec) * time.ns_per_s + st.atimespec.nsec,
161 .mtime = @as(i128, st.mtimespec.sec) * time.ns_per_s + st.mtimespec.nsec,
162 .ctime = @as(i128, st.ctimespec.sec) * time.ns_per_s + st.ctimespec.nsec,
163 };
164 }
154 }165 }
155166
156 pub fn kind(self: Stat) Kind {167 pub fn kind(self: Stat) Kind {
licenses.txt+1
...@@ -6,6 +6,7 @@ MPL-2.0:...@@ -6,6 +6,7 @@ MPL-2.0:
6MIT:6MIT:
7= https://spdx.org/licenses/MIT7= https://spdx.org/licenses/MIT
8- git https://github.com/nektro/zig-extras8- git https://github.com/nektro/zig-extras
9- git https://github.com/nektro/zig-sys-darwin
9- git https://github.com/nektro/zig-sys-linux10- git https://github.com/nektro/zig-sys-linux
10- git https://github.com/nektro/zig-time11- git https://github.com/nektro/zig-time
1112
nfs.zig+3-3
...@@ -9,12 +9,12 @@ const os = builtin.target.os.tag;...@@ -9,12 +9,12 @@ const os = builtin.target.os.tag;
99
10const sys = switch (os) {10const sys = switch (os) {
11 .linux => sys_linux,11 .linux => sys_linux,
12 .macos => @import("sys-darwin"),
12 else => unreachable,13 else => unreachable,
13};14};
1415
15pub const Handle = switch (os) {16pub const Handle = enum(c_int) {
16 .linux => enum(c_int) { _ },17 _,
17 else => unreachable,
18};18};
1919
20pub const Error = sys.errno.Error;20pub const Error = sys.errno.Error;
zigmod.yml+1
...@@ -9,3 +9,4 @@ dependencies:...@@ -9,3 +9,4 @@ dependencies:
9 - src: git https://github.com/nektro/zig-sys-linux9 - src: git https://github.com/nektro/zig-sys-linux
10 - src: git https://github.com/nektro/zig-nio10 - src: git https://github.com/nektro/zig-nio
11 - src: git https://github.com/nektro/zig-time11 - src: git https://github.com/nektro/zig-time
12 - src: git https://github.com/nektro/zig-sys-darwin