| ... | @@ -35,7 +35,7 @@ pub const Header = struct { | ... | @@ -35,7 +35,7 @@ pub const Header = struct { |
| 35 | pub fn fileSize(header: Header) !u64 { | 35 | pub fn fileSize(header: Header) !u64 { |
| 36 | const raw = header.bytes[124..][0..12]; | 36 | const raw = header.bytes[124..][0..12]; |
| 37 | const ltrimmed = std.mem.trimLeft(u8, raw, "0"); | 37 | const ltrimmed = std.mem.trimLeft(u8, raw, "0"); |
| 38 | const rtrimmed = std.mem.trimRight(u8, ltrimmed, "\x00"); | 38 | const rtrimmed = std.mem.trimRight(u8, ltrimmed, " \x00"); |
| 39 | if (rtrimmed.len == 0) return 0; | 39 | if (rtrimmed.len == 0) return 0; |
| 40 | return std.fmt.parseInt(u64, rtrimmed, 8); | 40 | return std.fmt.parseInt(u64, rtrimmed, 8); |
| 41 | } | 41 | } |
| ... | @@ -122,13 +122,16 @@ pub fn pipeToFileSystem(dir: std.fs.Dir, reader: anytype, options: Options) !voi | ... | @@ -122,13 +122,16 @@ pub fn pipeToFileSystem(dir: std.fs.Dir, reader: anytype, options: Options) !voi |
| 122 | .directory => { | 122 | .directory => { |
| 123 | const file_name = try stripComponents(unstripped_file_name, options.strip_components); | 123 | const file_name = try stripComponents(unstripped_file_name, options.strip_components); |
| 124 | if (file_name.len != 0) { | 124 | if (file_name.len != 0) { |
| 125 | try dir.makeDir(file_name); | 125 | try dir.makePath(file_name); |
| 126 | } | 126 | } |
| 127 | }, | 127 | }, |
| 128 | .normal => { | 128 | .normal => { |
| 129 | if (file_size == 0 and unstripped_file_name.len == 0) return; | 129 | if (file_size == 0 and unstripped_file_name.len == 0) return; |
| 130 | const file_name = try stripComponents(unstripped_file_name, options.strip_components); | 130 | const file_name = try stripComponents(unstripped_file_name, options.strip_components); |
| 131 | | 131 | |
| | 132 | if (std.fs.path.dirname(file_name)) |dir_name| { |
| | 133 | try dir.makePath(dir_name); |
| | 134 | } |
| 132 | var file = try dir.createFile(file_name, .{}); | 135 | var file = try dir.createFile(file_name, .{}); |
| 133 | defer file.close(); | 136 | defer file.close(); |
| 134 | | 137 | |