Added uid & gid
This commit is contained in:
+9
-1
@@ -59,7 +59,7 @@ pub const File = struct {
|
||||
return out;
|
||||
}
|
||||
|
||||
fn file_path(self: File, alloc: std.mem.Allocator) ![]u8 {
|
||||
pub fn file_path(self: File, alloc: std.mem.Allocator) ![]u8 {
|
||||
if (self.parent_path.len == 0) {
|
||||
const out = try alloc.alloc(u8, self.name.len);
|
||||
@memcpy(out, self.name);
|
||||
@@ -68,6 +68,14 @@ pub const File = struct {
|
||||
return std.mem.concat(alloc, u8, &[3][]const u8{ self.parent_path, "/", self.name });
|
||||
}
|
||||
|
||||
pub fn uid(self: File, rdr: *Reader) !u32 {
|
||||
return rdr.id_table.getValue(rdr, self.inode.header.uid_idx);
|
||||
}
|
||||
|
||||
pub fn gid(self: File, rdr: *Reader) !u32 {
|
||||
return rdr.id_table.getValue(rdr, self.inode.header.gid_idx);
|
||||
}
|
||||
|
||||
pub fn deinit(self: *File, alloc: std.mem.Allocator) void {
|
||||
self.inode.deinit();
|
||||
alloc.free(self.name);
|
||||
|
||||
Reference in New Issue
Block a user