Finished (?) extraction

Fixed missing zlib_compat (updated library)
This commit is contained in:
Caleb J. Gardner
2026-06-02 18:31:00 -05:00
parent 01d87f6948
commit c51cc34f17
8 changed files with 70 additions and 36 deletions
+5 -9
View File
@@ -64,7 +64,7 @@ pub fn deinit(self: SfsFile) void {
/// Attempts to open the filepath if the SfsFile is a directory.
/// If the given path refers to itself (such as "" or "."), a copied SfsFile is returned.
pub fn open(self: SfsFile, alloc: std.mem.Allocator, io: Io, filepath: []const u8) !SfsFile {
pub fn open(self: *SfsFile, alloc: std.mem.Allocator, io: Io, filepath: []const u8) !SfsFile {
const path = std.mem.trim(u8, filepath, "/");
const first_element: []const u8 = std.mem.sliceTo(path, '/');
@@ -86,17 +86,13 @@ pub fn open(self: SfsFile, alloc: std.mem.Allocator, io: Io, filepath: []const u
}
if (first_element.len == path.len) return .initDirEntry(alloc, io, self.archive, cur_slice[idx]);
if (cur_slice[idx].type != .dir) return error.NotFound;
const tmp_file: SfsFile = try .initDirEntry(alloc, io, self.archive, cur_slice[idx]);
var tmp_file: SfsFile = try .initDirEntry(alloc, io, self.archive, cur_slice[idx]);
defer tmp_file.deinit();
return tmp_file.open(alloc, io, path[first_element.len..]);
}
pub fn extract(self: SfsFile, alloc: std.mem.Allocator, io: Io, ext_dir: []const u8, options: ExtractionOptions) !void {
_ = self;
_ = alloc;
_ = io;
_ = ext_dir;
_ = options;
return error.TODO;
const Extract = @import("extract.zig");
pub fn extract(self: *SfsFile, alloc: std.mem.Allocator, io: Io, ext_dir: []const u8, options: ExtractionOptions) !void {
return Extract.extract(alloc, io, self.inode, &self.archive.cache, self.archive.super, ext_dir, options);
}