diff --git a/build.zig b/build.zig index 926570a..d2077be 100644 --- a/build.zig +++ b/build.zig @@ -138,7 +138,7 @@ pub fn build(b: *std.Build) void { b.installArtifact(mkfs_fat); // Usage: - var self_dep = std.Build.Dependency{ + var self_dep: std.Build.Dependency = .{ .builder = b, }; usageDemo(b, &self_dep, debug_step); @@ -175,7 +175,7 @@ fn installDebugDisk( pub fn initializeDisk(dependency: *std.Build.Dependency, size: u64, content: Content) *InitializeDiskStep { const ids = dependency.builder.allocator.create(InitializeDiskStep) catch @panic("out of memory"); - ids.* = InitializeDiskStep{ + ids.* = .{ .step = std.Build.Step.init(.{ .owner = dependency.builder, // TODO: Is this correct? .id = .custom, @@ -459,16 +459,16 @@ pub const InitializeDiskStep = struct { for (fs.items) |item| { switch (item) { .empty_dir => |dir| { - try argv.append(b.fmt("mkdir:{s}", .{dir})); + try argv.append(b.fmt("mkdir;{s}", .{dir})); }, .copy_dir => |src_dst| { - try argv.append(b.fmt("dir:{s}:{s}", .{ + try argv.append(b.fmt("dir;{s};{s}", .{ src_dst.source.getPath2(b, asking), src_dst.destination, })); }, .copy_file => |src_dst| { - try argv.append(b.fmt("file:{s}:{s}", .{ + try argv.append(b.fmt("file;{s};{s}", .{ src_dst.source.getPath2(b, asking), src_dst.destination, })); @@ -564,7 +564,7 @@ pub const InitializeDiskStep = struct { try disk.writeAll("\x00"); try disk.seekTo(0); - var context = HumanContext{}; + var context: HumanContext = .{}; context.appendSliceAssumeCapacity("disk"); const disk_image = DiskImage{ @@ -943,9 +943,9 @@ pub const FileSystem = struct { /// is a list of operations that should be performed on the file system: /// - format Formats the disk image. /// - mount Mounts the file system, must be before all following: - /// - mkdir: Creates directory and all necessary parents. - /// - file:: Copy to path . If exists, it will be overwritten. - /// - dir:: Copy recursively into . If exists, they will be merged. + /// - mkdir; Creates directory and all necessary parents. + /// - file;; Copy to path . If exists, it will be overwritten. + /// - dir;; Copy recursively into . If exists, they will be merged. /// /// paths are always rooted, even if they don't start with a /, and always use / as a path separator. /// @@ -986,7 +986,7 @@ pub const FileSystemBuilder = struct { format: FileSystem.Format, label: []const u8, }) FileSystem { - return FileSystem{ + return .{ .format = options.format, .label = fsb.b.dupe(options.label), .items = fsb.list.toOwnedSlice(fsb.b.allocator) catch @panic("out of memory"), diff --git a/src/mkfs.fat.zig b/src/mkfs.fat.zig index a88a76b..5f99349 100644 --- a/src/mkfs.fat.zig +++ b/src/mkfs.fat.zig @@ -81,7 +81,7 @@ pub fn mkfile(path: []const u8, host_file: std.fs.File) !void { fn disk_getStatus(intf: *fatfs.Disk) fatfs.Disk.Status { _ = intf; - return fatfs.Disk.Status{ + return .{ .initialized = true, .disk_present = true, .write_protected = false, diff --git a/src/shared.zig b/src/shared.zig index b506e96..990aff8 100644 --- a/src/shared.zig +++ b/src/shared.zig @@ -8,9 +8,9 @@ const std = @import("std"); // is a list of operations that should be performed on the file system: // - format Formats the disk image. // - mount Mounts the file system, must be before all following: -// - mkdir: Creates directory and all necessary parents. -// - file:: Copy to path . If exists, it will be overwritten. -// - dir:: Copy recursively into . If exists, they will be merged. +// - mkdir; Creates directory and all necessary parents. +// - file;; Copy to path . If exists, it will be overwritten. +// - dir;; Copy recursively into . If exists, they will be merged. // // paths are always rooted, even if they don't start with a /, and always use / as a path separator. // @@ -56,7 +56,7 @@ pub fn App(comptime Context: type) type { if (byte_base + byte_len > stat.size) return mistake("invalid offsets.", .{}); - device = BlockDevice{ + device = .{ .file = &image_file, .base = byte_base, .count = byte_len / BlockDevice.block_size, @@ -70,7 +70,7 @@ pub fn App(comptime Context: type) type { try Context.init(file_system); for (command_list) |command_sequence| { - var cmd_iter = std.mem.splitScalar(u8, command_sequence, ':'); + var cmd_iter = std.mem.splitScalar(u8, command_sequence, ';'); const command_str = cmd_iter.next() orelse return mistake("bad command", .{}); @@ -84,15 +84,15 @@ pub fn App(comptime Context: type) type { try Context.mount(); }, .mkdir => { - const dir = try normalize(cmd_iter.next() orelse return mistake("mkdir: is missing it's path!", .{})); + const dir = try normalize(cmd_iter.next() orelse return mistake("mkdir; is missing it's path!", .{})); // std.log.info("mkdir(\"{}\")", .{std.zig.fmtEscapes(dir)}); try recursiveMkDir(dir); }, .file => { - const src = cmd_iter.next() orelse return mistake("file:: is missing it's path!", .{}); - const dst = try normalize(cmd_iter.next() orelse return mistake("file:: is missing it's path!", .{})); + const src = cmd_iter.next() orelse return mistake("file;; is missing it's path!", .{}); + const dst = try normalize(cmd_iter.next() orelse return mistake("file;; is missing it's path!", .{})); // std.log.info("file(\"{}\", \"{}\")", .{ std.zig.fmtEscapes(src), std.zig.fmtEscapes(dst) }); @@ -102,10 +102,8 @@ pub fn App(comptime Context: type) type { try addFile(file, dst); }, .dir => { - const src = cmd_iter.next() orelse return mistake("dir:: is missing it's path!", .{}); - const dst = try normalize(cmd_iter.next() orelse return mistake("dir:: is missing it's path!", .{})); - - // std.log.info("dir(\"{}\", \"{}\")", .{ std.zig.fmtEscapes(src), std.zig.fmtEscapes(dst) }); + const src = cmd_iter.next() orelse return mistake("dir;; is missing it's path!", .{}); + const dst = try normalize(cmd_iter.next() orelse return mistake("dir;; is missing it's path!", .{})); var iter_dir = try std.fs.cwd().openDir(src, .{ .iterate = true }); defer iter_dir.close();