| author | |
| committer | |
| log | 8d11ade6a769fe498ed20cdb4f80c6acf4ca91de |
| tree | 3519793f8db0e05d0b9a4239a8b440381fbb1501 |
| parent | de9606bed51ed59530b5f9f98609aded14398b98 |
`fd_t` is not declared on freestanding so returning a `Dir` causes an error.3 files changed, 8 insertions(+), 8 deletions(-)
lib/std/fs.zig+5-5| ... | @@ -231,17 +231,17 @@ pub fn renameW(old_dir: Dir, old_sub_path_w: []const u16, new_dir: Dir, new_sub_ | ... | @@ -231,17 +231,17 @@ pub fn renameW(old_dir: Dir, old_sub_path_w: []const u16, new_dir: Dir, new_sub_ |
| 231 | /// On POSIX targets, this function is comptime-callable. | 231 | /// On POSIX targets, this function is comptime-callable. |
| 232 | pub fn cwd() Dir { | 232 | pub fn cwd() Dir { |
| 233 | if (builtin.os.tag == .windows) { | 233 | if (builtin.os.tag == .windows) { |
| 234 | return Dir{ .fd = os.windows.peb().ProcessParameters.CurrentDirectory.Handle }; | 234 | return .{ .fd = os.windows.peb().ProcessParameters.CurrentDirectory.Handle }; |
| 235 | } else if (builtin.os.tag == .wasi) { | 235 | } else if (builtin.os.tag == .wasi) { |
| 236 | return std.options.wasiCwd(); | 236 | return .{ .fd = std.options.wasiCwd() }; |
| 237 | } else { | 237 | } else { |
| 238 | return Dir{ .fd = os.AT.FDCWD }; | 238 | return .{ .fd = os.AT.FDCWD }; |
| 239 | } | 239 | } |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | pub fn defaultWasiCwd() Dir { | 242 | pub fn defaultWasiCwd() std.os.wasi.fd_t { |
| 243 | // Expect the first preopen to be current working directory. | 243 | // Expect the first preopen to be current working directory. |
| 244 | return .{ .fd = 3 }; | 244 | return 3; |
| 245 | } | 245 | } |
| 246 | 246 | ||
| 247 | /// Opens a directory at the given path. The directory is a system resource that remains | 247 | /// Opens a directory at the given path. The directory is a system resource that remains |
lib/std/std.zig+1-1| ... | @@ -203,7 +203,7 @@ pub const Options = struct { | ... | @@ -203,7 +203,7 @@ pub const Options = struct { |
| 203 | enable_segfault_handler: bool = debug.default_enable_segfault_handler, | 203 | enable_segfault_handler: bool = debug.default_enable_segfault_handler, |
| 204 | 204 | ||
| 205 | /// Function used to implement `std.fs.cwd` for WASI. | 205 | /// Function used to implement `std.fs.cwd` for WASI. |
| 206 | wasiCwd: fn () fs.Dir = fs.defaultWasiCwd, | 206 | wasiCwd: fn () os.wasi.fd_t = fs.defaultWasiCwd, |
| 207 | 207 | ||
| 208 | /// The current log level. | 208 | /// The current log level. |
| 209 | log_level: log.Level = log.default_level, | 209 | log_level: log.Level = log.default_level, |
src/main.zig+2-2| ... | @@ -45,11 +45,11 @@ pub const std_options = .{ | ... | @@ -45,11 +45,11 @@ pub const std_options = .{ |
| 45 | pub const panic = crash_report.panic; | 45 | pub const panic = crash_report.panic; |
| 46 | 46 | ||
| 47 | var wasi_preopens: fs.wasi.Preopens = undefined; | 47 | var wasi_preopens: fs.wasi.Preopens = undefined; |
| 48 | pub fn wasi_cwd() fs.Dir { | 48 | pub fn wasi_cwd() std.os.wasi.fd_t { |
| 49 | // Expect the first preopen to be current working directory. | 49 | // Expect the first preopen to be current working directory. |
| 50 | const cwd_fd: std.os.fd_t = 3; | 50 | const cwd_fd: std.os.fd_t = 3; |
| 51 | assert(mem.eql(u8, wasi_preopens.names[cwd_fd], ".")); | 51 | assert(mem.eql(u8, wasi_preopens.names[cwd_fd], ".")); |
| 52 | return .{ .fd = cwd_fd }; | 52 | return cwd_fd; |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | pub fn getWasiPreopen(name: []const u8) Compilation.Directory { | 55 | pub fn getWasiPreopen(name: []const u8) Compilation.Directory { |