| ... | ... | @@ -222,8 +222,8 @@ pub const File = extern struct { |
| 222 | 222 | self: *const File, |
| 223 | 223 | comptime info: std.meta.Tag(Info), |
| 224 | 224 | buffer: ?[]u8, |
| 225 | | ) GetInfoError!struct { usize, ?*std.meta.TagPayload(Info, info) } { |
| 226 | | const InfoType = std.meta.TagPayload(Info, info); |
| 225 | ) GetInfoError!struct { usize, @FieldType(Info, @tagName(info)) } { |
| 226 | const InfoType = @FieldType(Info, @tagName(info)); |
| 227 | 227 | |
| 228 | 228 | var len = if (buffer) |b| b.len else 0; |
| 229 | 229 | switch (self._get_info( |
| ... | ... | @@ -245,17 +245,15 @@ pub const File = extern struct { |
| 245 | 245 | pub fn setInfo( |
| 246 | 246 | self: *File, |
| 247 | 247 | comptime info: std.meta.Tag(Info), |
| 248 | | data: *const std.meta.TagPayload(Info, info), |
| 248 | data: *const @FieldType(Info, @tagName(info)), |
| 249 | 249 | ) SetInfoError!void { |
| 250 | | const InfoType = std.meta.TagPayload(Info, info); |
| 250 | const InfoType = @FieldType(Info, @tagName(info)); |
| 251 | 251 | |
| 252 | | var attached_str_len: usize = 0; |
| 253 | 252 | const attached_str: [*:0]const u16 = switch (info) { |
| 254 | 253 | .file => data.getFileName(), |
| 255 | 254 | inline .file_system, .volume_label => data.getVolumeLabel(), |
| 256 | 255 | }; |
| 257 | | |
| 258 | | while (attached_str[attached_str_len] != 0) : (attached_str_len += 1) {} |
| 256 | const attached_str_len = std.mem.sliceTo(attached_str, 0).len; |
| 259 | 257 | |
| 260 | 258 | // add the length (not +1 for sentinel) because `@sizeOf(InfoType)` |
| 261 | 259 | // already contains the first utf16 char |