| author | |
| committer | |
| log | 18b00c5c5d25e230ff4f3ea07fadb2a1d54a773d |
| tree | 35cedd92bc61d27215ff0a1b52ad653d3af51040 |
| parent | cd5a750bf6d58fa355efe2223c3f9c0626198f13 |
| signature |
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; |
| 9 | 9 | ||
| 10 | const sys = switch (os) { | 10 | const 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 | }; |
| 14 | 15 |
File.zig+11| ... | @@ -11,6 +11,7 @@ const os = builtin.target.os.tag; | ... | @@ -11,6 +11,7 @@ const os = builtin.target.os.tag; |
| 11 | 11 | ||
| 12 | const sys = switch (os) { | 12 | const 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 | }; |
| 16 | 17 | ||
| ... | @@ -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 | } |
| 155 | 166 | ||
| 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: |
| 6 | MIT: | 6 | MIT: |
| 7 | = https://spdx.org/licenses/MIT | 7 | = https://spdx.org/licenses/MIT |
| 8 | - git https://github.com/nektro/zig-extras | 8 | - git https://github.com/nektro/zig-extras |
| 9 | - git https://github.com/nektro/zig-sys-darwin | ||
| 9 | - git https://github.com/nektro/zig-sys-linux | 10 | - git https://github.com/nektro/zig-sys-linux |
| 10 | - git https://github.com/nektro/zig-time | 11 | - git https://github.com/nektro/zig-time |
| 11 | 12 |
nfs.zig+3-3| ... | @@ -9,12 +9,12 @@ const os = builtin.target.os.tag; | ... | @@ -9,12 +9,12 @@ const os = builtin.target.os.tag; |
| 9 | 9 | ||
| 10 | const sys = switch (os) { | 10 | const sys = switch (os) { |
| 11 | .linux => sys_linux, | 11 | .linux => sys_linux, |
| 12 | .macos => @import("sys-darwin"), | ||
| 12 | else => unreachable, | 13 | else => unreachable, |
| 13 | }; | 14 | }; |
| 14 | 15 | ||
| 15 | pub const Handle = switch (os) { | 16 | pub const Handle = enum(c_int) { |
| 16 | .linux => enum(c_int) { _ }, | 17 | _, |
| 17 | else => unreachable, | ||
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | pub const Error = sys.errno.Error; | 20 | pub 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-linux | 9 | - src: git https://github.com/nektro/zig-sys-linux |
| 10 | - src: git https://github.com/nektro/zig-nio | 10 | - src: git https://github.com/nektro/zig-nio |
| 11 | - src: git https://github.com/nektro/zig-time | 11 | - src: git https://github.com/nektro/zig-time |
| 12 | - src: git https://github.com/nektro/zig-sys-darwin |