Skip to content

Commit c699dc5

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents c3cf822 + 0488182 commit c699dc5

File tree

3 files changed

+18
-20
lines changed

3 files changed

+18
-20
lines changed

build.zig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ pub fn build(b: *std.Build) void {
138138
b.installArtifact(mkfs_fat);
139139

140140
// Usage:
141-
var self_dep = std.Build.Dependency{
141+
var self_dep: std.Build.Dependency = .{
142142
.builder = b,
143143
};
144144
usageDemo(b, &self_dep, debug_step);
@@ -175,7 +175,7 @@ fn installDebugDisk(
175175
pub fn initializeDisk(dependency: *std.Build.Dependency, size: u64, content: Content) *InitializeDiskStep {
176176
const ids = dependency.builder.allocator.create(InitializeDiskStep) catch @panic("out of memory");
177177

178-
ids.* = InitializeDiskStep{
178+
ids.* = .{
179179
.step = std.Build.Step.init(.{
180180
.owner = dependency.builder, // TODO: Is this correct?
181181
.id = .custom,
@@ -563,7 +563,7 @@ pub const InitializeDiskStep = struct {
563563
try disk.writeAll("\x00");
564564
try disk.seekTo(0);
565565

566-
var context = HumanContext{};
566+
var context: HumanContext = .{};
567567
context.appendSliceAssumeCapacity("disk");
568568

569569
const disk_image = DiskImage{
@@ -943,9 +943,9 @@ pub const FileSystem = struct {
943943
/// <ops...> is a list of operations that should be performed on the file system:
944944
/// - format Formats the disk image.
945945
/// - mount Mounts the file system, must be before all following:
946-
/// - mkdir:<dst> Creates directory <dst> and all necessary parents.
947-
/// - file:<src>:<dst> Copy <src> to path <dst>. If <dst> exists, it will be overwritten.
948-
/// - dir:<src>:<dst> Copy <src> recursively into <dst>. If <dst> exists, they will be merged.
946+
/// - mkdir;<dst> Creates directory <dst> and all necessary parents.
947+
/// - file;<src>;<dst> Copy <src> to path <dst>. If <dst> exists, it will be overwritten.
948+
/// - dir;<src>;<dst> Copy <src> recursively into <dst>. If <dst> exists, they will be merged.
949949
///
950950
/// <dst> paths are always rooted, even if they don't start with a /, and always use / as a path separator.
951951
///
@@ -986,7 +986,7 @@ pub const FileSystemBuilder = struct {
986986
format: FileSystem.Format,
987987
label: []const u8,
988988
}) FileSystem {
989-
return FileSystem{
989+
return .{
990990
.format = options.format,
991991
.label = fsb.b.dupe(options.label),
992992
.items = fsb.list.toOwnedSlice(fsb.b.allocator) catch @panic("out of memory"),

src/mkfs.fat.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub const std_options: std.Options = .{
1212
},
1313
};
1414

15-
var fat_disk: fatfs.Disk = fatfs.Disk{
15+
var fat_disk: fatfs.Disk = .{
1616
.getStatusFn = disk_getStatus,
1717
.initializeFn = disk_initialize,
1818
.readFn = disk_read,
@@ -81,7 +81,7 @@ pub fn mkfile(path: []const u8, host_file: std.fs.File) !void {
8181

8282
fn disk_getStatus(intf: *fatfs.Disk) fatfs.Disk.Status {
8383
_ = intf;
84-
return fatfs.Disk.Status{
84+
return .{
8585
.initialized = true,
8686
.disk_present = true,
8787
.write_protected = false,

src/shared.zig

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ const std = @import("std");
88
// <ops...> is a list of operations that should be performed on the file system:
99
// - format Formats the disk image.
1010
// - mount Mounts the file system, must be before all following:
11-
// - mkdir:<dst> Creates directory <dst> and all necessary parents.
12-
// - file:<src>:<dst> Copy <src> to path <dst>. If <dst> exists, it will be overwritten.
13-
// - dir:<src>:<dst> Copy <src> recursively into <dst>. If <dst> exists, they will be merged.
11+
// - mkdir;<dst> Creates directory <dst> and all necessary parents.
12+
// - file;<src>;<dst> Copy <src> to path <dst>. If <dst> exists, it will be overwritten.
13+
// - dir;<src>;<dst> Copy <src> recursively into <dst>. If <dst> exists, they will be merged.
1414
//
1515
// <dst> paths are always rooted, even if they don't start with a /, and always use / as a path separator.
1616
//
@@ -56,7 +56,7 @@ pub fn App(comptime Context: type) type {
5656
if (byte_base + byte_len > stat.size)
5757
return mistake("invalid offsets.", .{});
5858

59-
device = BlockDevice{
59+
device = .{
6060
.file = &image_file,
6161
.base = byte_base,
6262
.count = byte_len / BlockDevice.block_size,
@@ -84,15 +84,15 @@ pub fn App(comptime Context: type) type {
8484
try Context.mount();
8585
},
8686
.mkdir => {
87-
const dir = try normalize(cmd_iter.next() orelse return mistake("mkdir:<dst> is missing it's <dst> path!", .{}));
87+
const dir = try normalize(cmd_iter.next() orelse return mistake("mkdir;<dst> is missing it's <dst> path!", .{}));
8888

8989
// std.log.info("mkdir(\"{}\")", .{std.zig.fmtEscapes(dir)});
9090

9191
try recursiveMkDir(dir);
9292
},
9393
.file => {
94-
const src = cmd_iter.next() orelse return mistake("file:<src>:<dst> is missing it's <src> path!", .{});
95-
const dst = try normalize(cmd_iter.next() orelse return mistake("file:<src>:<dst> is missing it's <dst> path!", .{}));
94+
const src = cmd_iter.next() orelse return mistake("file;<src>;<dst> is missing it's <src> path!", .{});
95+
const dst = try normalize(cmd_iter.next() orelse return mistake("file;<src>;<dst> is missing it's <dst> path!", .{}));
9696

9797
// std.log.info("file(\"{}\", \"{}\")", .{ std.zig.fmtEscapes(src), std.zig.fmtEscapes(dst) });
9898

@@ -108,10 +108,8 @@ pub fn App(comptime Context: type) type {
108108
try addFile(file, dst);
109109
},
110110
.dir => {
111-
const src = cmd_iter.next() orelse return mistake("dir:<src>:<dst> is missing it's <src> path!", .{});
112-
const dst = try normalize(cmd_iter.next() orelse return mistake("dir:<src>:<dst> is missing it's <dst> path!", .{}));
113-
114-
// std.log.info("dir(\"{}\", \"{}\")", .{ std.zig.fmtEscapes(src), std.zig.fmtEscapes(dst) });
111+
const src = cmd_iter.next() orelse return mistake("dir;<src>;<dst> is missing it's <src> path!", .{});
112+
const dst = try normalize(cmd_iter.next() orelse return mistake("dir;<src>;<dst> is missing it's <dst> path!", .{}));
115113

116114
var iter_dir = try std.fs.cwd().openDir(src, .{ .iterate = true });
117115
defer iter_dir.close();

0 commit comments

Comments
 (0)