| ... | @@ -1161,7 +1161,7 @@ pub fn realC(out_buffer: *[os.MAX_PATH_BYTES]u8, pathname: [*]const u8) RealErro | ... | @@ -1161,7 +1161,7 @@ pub fn realC(out_buffer: *[os.MAX_PATH_BYTES]u8, pathname: [*]const u8) RealErro |
| 1161 | const pathname_w = try windows_util.cStrToPrefixedFileW(pathname); | 1161 | const pathname_w = try windows_util.cStrToPrefixedFileW(pathname); |
| 1162 | return realW(out_buffer, pathname_w); | 1162 | return realW(out_buffer, pathname_w); |
| 1163 | }, | 1163 | }, |
| 1164 | Os.macosx, Os.ios => { | 1164 | Os.freebsd, Os.macosx, Os.ios => { |
| 1165 | // TODO instead of calling the libc function here, port the implementation to Zig | 1165 | // TODO instead of calling the libc function here, port the implementation to Zig |
| 1166 | const err = posix.getErrno(posix.realpath(pathname, out_buffer)); | 1166 | const err = posix.getErrno(posix.realpath(pathname, out_buffer)); |
| 1167 | switch (err) { | 1167 | switch (err) { |
| ... | @@ -1188,15 +1188,6 @@ pub fn realC(out_buffer: *[os.MAX_PATH_BYTES]u8, pathname: [*]const u8) RealErro | ... | @@ -1188,15 +1188,6 @@ pub fn realC(out_buffer: *[os.MAX_PATH_BYTES]u8, pathname: [*]const u8) RealErro |
| 1188 | | 1188 | |
| 1189 | return os.readLinkC(out_buffer, proc_path.ptr); | 1189 | return os.readLinkC(out_buffer, proc_path.ptr); |
| 1190 | }, | 1190 | }, |
| 1191 | Os.freebsd => { // XXX requires fdescfs | | |
| 1192 | const fd = try os.posixOpenC(pathname, posix.O_PATH | posix.O_NONBLOCK | posix.O_CLOEXEC, 0); | | |
| 1193 | defer os.close(fd); | | |
| 1194 | | | |
| 1195 | var buf: ["/dev/fd/-2147483648\x00".len]u8 = undefined; | | |
| 1196 | const proc_path = fmt.bufPrint(buf[0..], "/dev/fd/{}\x00", fd) catch unreachable; | | |
| 1197 | | | |
| 1198 | return os.readLinkC(out_buffer, proc_path.ptr); | | |
| 1199 | }, | | |
| 1200 | else => @compileError("TODO implement os.path.real for " ++ @tagName(builtin.os)), | 1191 | else => @compileError("TODO implement os.path.real for " ++ @tagName(builtin.os)), |
| 1201 | } | 1192 | } |
| 1202 | } | 1193 | } |