| ... | @@ -2017,7 +2017,7 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void { | ... | @@ -2017,7 +2017,7 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void { |
| 2017 | return process.cleanExit(io); | 2017 | return process.cleanExit(io); |
| 2018 | }, | 2018 | }, |
| 2019 | .minimal => { | 2019 | .minimal => { |
| 2020 | Templates.writeSimpleFile(io, Package.Manifest.basename, | 2020 | Templates.writeSimpleFile(io, Io.Dir.cwd(), Package.Manifest.basename, |
| 2021 | \\.{{ | 2021 | \\.{{ |
| 2022 | \\ .name = .{s}, | 2022 | \\ .name = .{s}, |
| 2023 | \\ .version = "0.0.1", | 2023 | \\ .version = "0.0.1", |
| ... | @@ -2034,7 +2034,7 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void { | ... | @@ -2034,7 +2034,7 @@ fn cmdInit(gpa: Allocator, graph: *Graph, args: []const []const u8) !void { |
| 2034 | else => fatal("failed to create {q}: {t}", .{ Package.Manifest.basename, err }), | 2034 | else => fatal("failed to create {q}: {t}", .{ Package.Manifest.basename, err }), |
| 2035 | error.PathAlreadyExists => fatal("refusing to overwrite {q}", .{Package.Manifest.basename}), | 2035 | error.PathAlreadyExists => fatal("refusing to overwrite {q}", .{Package.Manifest.basename}), |
| 2036 | }; | 2036 | }; |
| 2037 | Templates.writeSimpleFile(io, default_build_zig_basename, | 2037 | Templates.writeSimpleFile(io, Io.Dir.cwd(), default_build_zig_basename, |
| 2038 | \\const std = @import("std"); | 2038 | \\const std = @import("std"); |
| 2039 | \\ | 2039 | \\ |
| 2040 | \\pub fn build(b: *std.Build) void {{ | 2040 | \\pub fn build(b: *std.Build) void {{ |
| ... | @@ -3840,7 +3840,7 @@ fn loadManifest( | ... | @@ -3840,7 +3840,7 @@ fn loadManifest( |
| 3840 | 0, | 3840 | 0, |
| 3841 | ) catch |err| switch (err) { | 3841 | ) catch |err| switch (err) { |
| 3842 | error.FileNotFound => { | 3842 | error.FileNotFound => { |
| 3843 | Templates.writeSimpleFile(io, Package.Manifest.basename, | 3843 | Templates.writeSimpleFile(io, options.dir, Package.Manifest.basename, |
| 3844 | \\.{{ | 3844 | \\.{{ |
| 3845 | \\ .name = .{s}, | 3845 | \\ .name = .{s}, |
| 3846 | \\ .version = "0.0.1", | 3846 | \\ .version = "0.0.1", |
| ... | @@ -4002,8 +4002,8 @@ const Templates = struct { | ... | @@ -4002,8 +4002,8 @@ const Templates = struct { |
| 4002 | }; | 4002 | }; |
| 4003 | } | 4003 | } |
| 4004 | | 4004 | |
| 4005 | fn writeSimpleFile(io: Io, file_name: []const u8, comptime format: []const u8, args: anytype) !void { | 4005 | fn writeSimpleFile(io: Io, dir: Io.Dir, file_name: []const u8, comptime format: []const u8, args: anytype) !void { |
| 4006 | const f = try Io.Dir.cwd().createFile(io, file_name, .{ .exclusive = true }); | 4006 | const f = try dir.createFile(io, file_name, .{ .exclusive = true }); |
| 4007 | defer f.close(io); | 4007 | defer f.close(io); |
| 4008 | var buf: [4096]u8 = undefined; | 4008 | var buf: [4096]u8 = undefined; |
| 4009 | var fw = f.writer(io, &buf); | 4009 | var fw = f.writer(io, &buf); |