Finished (?) extraction
Fixed missing zlib_compat (updated library)
This commit is contained in:
+5
-9
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user