diff --git a/src/cmd/init.zig b/src/cmd/init.zig index a2c50be1de5ba477bd7aab94462994d7e1813b99..a95784ef668eca48df0d8d440fe37bb3f655d628 100644 --- a/src/cmd/init.zig +++ b/src/cmd/init.zig @@ -143,7 +143,7 @@ pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { const do = try inquirer.forConfirm(stdout, stdin, "It appears you're using git. Do you want init to add Zigmod to your .gitignore?", gpa); if (do) { const exists = try nfs.cwd().exists(".gitignore"); - const file: nfs.File = try (if (exists) cwd.openFile(".gitignore", .{ .mode = .read_write }) else cwd.createFile(".gitignore", .{})); + const file = try cwd.createFile(".gitignore", .{ .truncate = false }); defer file.close(); const len = try file.getEndPos(); if (len > 0) try file.seekTo(len - 1); @@ -165,7 +165,7 @@ pub fn execute(self_name: []const u8, args: []const [:0]const u8) !void { const do = try inquirer.forConfirm(stdout, stdin, "It appears you're using git. Do you want init to add Zigmod to your .gitattributes?", gpa); if (do) { const exists = try nfs.cwd().exists(".gitattributes"); - const file: nfs.File = try (if (exists) cwd.openFile(".gitattributes", .{ .mode = .read_write }) else cwd.createFile(".gitattributes", .{})); + const file = try cwd.createFile(".gitattributes", .{ .truncate = false }); defer file.close(); const len = try file.getEndPos(); if (len > 0) try file.seekTo(len - 1);