aboutsummaryrefslogtreecommitdiff
path: root/lib/compiler/resinator
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-12-08 17:14:31 -0800
committerAndrew Kelley <andrew@ziglang.org>2025-12-23 22:15:08 -0800
commit950d18ef695bb7a28397e080dc3c201559ec4ee2 (patch)
tree253209139275932ed503a5ea4529594ab70df8cc /lib/compiler/resinator
parent314c906dba32e72317947a15254519b22745b13f (diff)
downloadzig-950d18ef695bb7a28397e080dc3c201559ec4ee2.tar.gz
zig-950d18ef695bb7a28397e080dc3c201559ec4ee2.zip
update all access() to access(io)
Diffstat (limited to 'lib/compiler/resinator')
-rw-r--r--lib/compiler/resinator/cli.zig10
-rw-r--r--lib/compiler/resinator/main.zig6
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/compiler/resinator/cli.zig b/lib/compiler/resinator/cli.zig
index ae4ece2968..5588390197 100644
--- a/lib/compiler/resinator/cli.zig
+++ b/lib/compiler/resinator/cli.zig
@@ -250,13 +250,13 @@ pub const Options = struct {
/// worlds' situation where we'll be compatible with most use-cases
/// of the .rc extension being omitted from the CLI args, but still
/// work fine if the file itself does not have an extension.
- pub fn maybeAppendRC(options: *Options, cwd: Io.Dir) !void {
+ pub fn maybeAppendRC(options: *Options, io: Io, cwd: Io.Dir) !void {
switch (options.input_source) {
.stdio => return,
.filename => {},
}
if (options.input_format == .rc and std.fs.path.extension(options.input_source.filename).len == 0) {
- cwd.access(options.input_source.filename, .{}) catch |err| switch (err) {
+ cwd.access(io, options.input_source.filename, .{}) catch |err| switch (err) {
error.FileNotFound => {
var filename_bytes = try options.allocator.alloc(u8, options.input_source.filename.len + 3);
@memcpy(filename_bytes[0..options.input_source.filename.len], options.input_source.filename);
@@ -2005,19 +2005,19 @@ test "maybeAppendRC" {
// appended.
var file = try tmp.dir.createFile(io, "foo", .{});
file.close(io);
- try options.maybeAppendRC(tmp.dir);
+ try options.maybeAppendRC(io, tmp.dir);
try std.testing.expectEqualStrings("foo", options.input_source.filename);
// Now delete the file and try again. But this time change the input format
// to non-rc.
try tmp.dir.deleteFile("foo");
options.input_format = .res;
- try options.maybeAppendRC(tmp.dir);
+ try options.maybeAppendRC(io, tmp.dir);
try std.testing.expectEqualStrings("foo", options.input_source.filename);
// Finally, reset the input format to rc. Since the verbatim name is no longer found
// and the input filename does not have an extension, .rc should get appended.
options.input_format = .rc;
- try options.maybeAppendRC(tmp.dir);
+ try options.maybeAppendRC(io, tmp.dir);
try std.testing.expectEqualStrings("foo.rc", options.input_source.filename);
}
diff --git a/lib/compiler/resinator/main.zig b/lib/compiler/resinator/main.zig
index 416abc2ab7..1a6ef5eea3 100644
--- a/lib/compiler/resinator/main.zig
+++ b/lib/compiler/resinator/main.zig
@@ -318,7 +318,7 @@ pub fn main() !void {
defer depfile.close(io);
var depfile_buffer: [1024]u8 = undefined;
- var depfile_writer = depfile.writer(&depfile_buffer);
+ var depfile_writer = depfile.writer(io, &depfile_buffer);
switch (options.depfile_fmt) {
.json => {
var write_stream: std.json.Stringify = .{
@@ -521,9 +521,9 @@ const IoStream = struct {
}
};
- pub fn writer(source: *Source, allocator: Allocator, buffer: []u8) Writer {
+ pub fn writer(source: *Source, allocator: Allocator, io: Io, buffer: []u8) Writer {
return switch (source.*) {
- .file, .stdio => |file| .{ .file = file.writer(buffer) },
+ .file, .stdio => |file| .{ .file = file.writer(io, buffer) },
.memory => |*list| .{ .allocating = .fromArrayList(allocator, list) },
.closed => unreachable,
};